Language:
Page Info
Skill Level:
Engine Version:

Adding Components in Blueprints

On this page, you will learn how to add Components to a Blueprint and how Components can be accessed and modified inside a Blueprint. To show this, we will create a simple burning bush Blueprint Actor that is comprised of three components: the Static Mesh Component (the Bush), an Audio Component (fire sound effect) and a Particle Effect (the visible fire effect).

Adding Components to a Blueprint

For this example, we are using the Blueprint Third Person Template with Starter Content.

The steps below will show you how to Add Components to a Blueprint Actor.

  1. In the Content Browser, under the StarterContent/Props folder, Right-click on the SM_Bush asset, scroll up to Asset Actions, and select Create Blueprint Using This....

    Components1.jpg

    This will create a Blueprint based on this asset and will add it to the Blueprint as a Component.

  2. Click Ok when the Create Blueprint window opens.

  3. In the Content Browser, under the StarterContent/Blueprint folder, open the SM_Bush Blueprint.

  4. In the Blueprint Editor window, click the Viewport tab in the upper left of the window.

    Components2.png

    You will notice that the Bush has already been added as a Component to our Burning Bush Actor.

  5. On the Components tab, click the Add Component button in the Components window.

    Components3.png

    This window allows you to add Components to the Blueprint, in this case we can add a fire and audio effect.

  6. Click Audio to add an Audio Component and notice that the Details window is populated below the Components window.

    Components4.png

    This is where you specify the details regarding the Component. Depending upon the Component added, varying options will be presented that you can define. In this case, we want to define the actual Sound Asset that the Audio Component will use.

  7. In the Details panel, click the None box under Sound then select the Fire01_Cue asset.

    Components5.png

    We have now added a fire sound effect that emits from our Bush.

  8. Click the Add Component button again and scroll through the list and add a Particle System Component.

    Components6.png

  9. In the Details panel for the Particle Effect, click the None box next to Template and select P_Fire.

    Components7.png

  10. We now are ready to finish the Blueprint, click the Compile button in the upper left of the window.

    Components8.png

    After you Compile, you should see the green check to indicate that it was successful.

    Components9.png

  11. Close the Blueprint, then in the Content Browser, under Game/Blueprints, drag the SM_Bush into the level.

    Components10.png

  12. Click the Play Button to play in the editor.

You should now see that we have a bush that is on fire and plays a fire audio effect. As you move away from the bush, the audio should fade out and it should fade in as you move close to the bush.

We have created a Blueprint Actor that is comprised of three Components, we could have placed the bush in the level, then placed the audio inside the bush, then placed the fire in the bush; however creating a Blueprint that has these Components is a far more manageable solution than having individual pieces.

Working with Components in Blueprints

Each of the Components inside a Blueprint can be accessed and modified from within the Blueprint itself or from an external Blueprint. For example, if we had a Car Blueprint and had an Engine Blueprint as a Component, we could modify the way the car performs by tweaking the values inside the Engine Blueprint.

Using the burning bush example from this page, if you look in the MyBlueprint window, you will notice that each of the Components are provided in the Components section:

Components12.png

Each of these Components can be placed inside the graph and access through Blueprint Script and modified (see the example below):

Components13.png

Here we are enabling input on the Burning Bush Blueprint Actor so that the player can modify it on a key press. We have added the F Key Event that when pressed, toggles between Deactivating and Activating the Particle System and Audio Components (turning them on or off when the key is pressed).

Additional Resources

There are several concepts that tie into Adding Components to Blueprints and the links below provide additional relevant information: