Software:
Unreal Engine 4.24
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:
Related:
UE4 Camera Animation