A blog about technical art, scripting, van renovation, and some other gubbins.

@henloco

Setting variables of a spawned actor in Unreal Engine

Published 29th January 2019 by Henry

As an example, say you want to spawn a blueprint actor called BP_FIRE_LOG and give it a unique ID number so that it can be referenced in the level.

The blueprint spawning the BP_FIRE_LOG blueprint is called BP_FIRE_SPAWN.

  1. In BP_FIRE_LOG, create a function called setLogID and add an integer input named logInstance with a default value of 0.
  2. Create variable logID in BP_FIRE_LOG
  3. Setup function nodes as below:

Now in the spawning blueprint Event Graph (BP_FIRE_SPAWN) create another integer variable called logInstance. The function setLogID can be called here, using logInstance as the input and an increment node straight after as shown here:

The logID/logInstance can now be used as an index, for example, in an array of instanced materials.

More

Previous

Maya MEL: Create a locator at selected vertices

Next

Week 16

Leave a Reply

Your email address will not be published. Required fields are marked *