Unreal Change a Component Into an Actor and Back Again

Components are a special blazon of Object designed to be used as sub-objects within Actors. These are by and large used in situations where it is necessary to have easily swappable parts in order to alter the beliefs or functionality of some particular aspect of the owning Histrion. For instance, a car is controlled and moves very differently from an shipping, which is controlled and moves differently from a boat, etc.; yet all of these are vehicles that share other commonalities. By using a Component to handle the controls and movement, the same vehicle can easily exist made to behave like whatever one of these specific types.

Implementation Guide

In this guide, you will learn how to add together Components to a Blueprint and how Components can be accessed and modified within a Blueprint. To prove this, nosotros will create a simple called-for bush Design Player that is comprised of three components: the Static Mesh Component (the Bush), an Audio Component (burn down sound consequence) and a Particle Effect (the visible fire effect).

Adding Components to a Blueprint

For this instance, nosotros are using the Design Third Person Template with Starter Content.

The steps below will show you how to Add together Components to a Design Player.

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

    Components1.jpg

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

  2. Click Ok when the Create Blueprint window opens.

  3. In the Content Browser, nether the StarterContent/Design folder, open the SM_Bush Design.

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

    Components2.png

    Y'all will notice that the Bush has already been added equally a Component to our Burning Bush Role player.

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

    Components3.png

    This window allows y'all to add Components to the Blueprint, in this case we can add together a fire and audio event.

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

    Components4.png

    This is where you specify the details regarding the Component. Depending upon the Component added, varying options volition be presented that you tin define. In this example, we desire to ascertain the actual Sound Nugget that the Sound Component volition use.

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

    Components5.png

    Nosotros have at present added a fire sound outcome that emits from our Bush.

  8. Click the Add together Component push button once more and scroll through the list and add a Particle Organisation 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. Nosotros now are ready to finish the Blueprint, click the Compile push in the upper left of the window.

    Components8.png

    Later you Compile, you should see the green check to betoken that it was successful.

    Components9.png

  11. Close the Blueprint, and so 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 meet that we accept a bush-league 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 lot move close to the bush.

Nosotros have created a Blueprint Actor that is comprised of three Components, we could accept placed the bush in the level, and then placed the audio within the bush, and so placed the burn down in the bush; notwithstanding 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 Design tin can be accessed and modified from within the Blueprint itself or from an external Blueprint. For example, if we had a Machine Blueprint and had an Engine Pattern every bit a Component, we could modify the way the car performs by tweaking the values inside the Engine Design.

Using the called-for bush example from this page, if you await in the MyBlueprint window, you lot volition 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 nosotros are enabling input on the Burning Bush Design Actor so that the player can change 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 central is pressed).

Additional Resources

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

  • Blueprint User Guide

  • Using Components in Blueprints

  • Working with Blueprint Graphs

boonetiond1964.blogspot.com

Source: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/HowTo/AddingComponents

0 Response to "Unreal Change a Component Into an Actor and Back Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel