When Spawning new actors via the SpanActor Blueprint node, initial transform must be supplied to the SpanActor node, and not defined in the spawned Actor Class’s Blueprint.
Just found out the hard way, that when you spawn an Actor using the SpawnActor blueprint node, the transform data connected to the SpawnActor node is actually applied after the actors Construction Script and BeginPlay Event.
This means any transform you will try to apply in the spawned Actor’s Blueprint will be overridden and therefore not work.
Had some frustrating time not understanding why doesn’t the FirstPersonProjectile Actor doesn’t “play ball” and generate Overlap Events when hitting my bad guys..
It turns out I had to change its collision (sphere) component’s collision settings to overlap dynamic objects (see image):
To create animations and trigger them to play on game start:
First create a Level Sequence containing the animation:
Create a new Level Sequence actor:
Name the new Level Sequence and drag it to into the level:
Select the actor you want to animate in the level and double click the Level Sequence in the Content Browser to open it in the Sequencer window:
In the Sequencer window, press the +Track button to add a sequence track, choose the upper most option Actor To Sequence, the option to Add the selected actor will automatically appear first on the menu that will open on the right:
Add the selected actor as a sequence track, expand the track’s Transform channels to reveal the Transform property you would like to animate, and click the + button for that channel to create the first key-frame:
Activate the Create when channels/properties change option button:
Move the time slider to a desired time for the motion and move/change the actors transform to create a new key-frame:
The Level Sequence now contains animation for the Actor, but when we play the game, the animation doesn’t play.
For the animation to play in game, we must trigger it fro a Blueprint, in this case the Level Blueprint:
From the Editor Blueprints menu, choose Open Level Blueprint:
In the Level Blueprint, drag the Event BeginPlay execution graph and create CreateLevelSequencePlayer node that will follow it:
Drag the CreateLevelSequencePlayer node’s Return Value output and create a Play node that will be executed after it and receive it’s output:
The Level Blueprint now has instructions to play a Level Sequence,
but it’s not yet specified which Level Sequence to play:
In the Variables list on the left, press the +Variable button to create a new variable and name it:
With the new variable selected, in it’s details on the right, press the Variable Type button, and locate Level Sequence – Object Reference type:
The Level Blueprint now contains a variable named seq of type: Level Sequence – Object Reference:
Drag the new variable to the Blueprint and choose Get when placing it:
Connect the variable’s output to the Level Sequence input of the CreateLevelSequencePlayer node:
With the variable selected, in the details panel on the right, select the Level Sequence object it will be referencing:
Press Compile and save the Level Blueprint:
The Level Blueprint now has instructions to play the desired Level Sequence when the level begins playing so a the animation we created plays when we hit play game in the editor:
A direct reference to another actor instance can’t be created from within the blueprint because it can only be provided at run-time after the instances have been created, both the current actor and the other actor we want to refer to.
In the Actor Blueprint:
Add a new variable of type Actor > Object Reference
Make the variable public and editable in the editor (the eye button..)
Hit Compile and Save.
In the Map Editor:
Place both actors in the map and save it.
Select the actor in which you created the reference variable.
In the Details panel, set the Actor property you created to the wanted other Actor instance.