Unreal Engine 5 Cinematics | Sequencer 101: Triggering Gameplay
Unreal Engine has been establishing itself as more than just an engine used for games for the last few years. More and more people are utilising its Cinematic tools to enable them not only to create in-game cutscenes, but also to create animations and films! No matter what you are using it for, the best way to get the most out of the engine is to have complete control over what happens throughout your cinematic.
✨Let’s learn how to trigger bespoke gameplay through the Sequencer✨
This tutorial requires you to have basic a understanding of Blueprints and how to create Functions and Events.
What is Sequencer?
Sequencer gives users control over the scene through Level Sequences. Within Level Sequences users can add tracks and create keyframes to manipulate objects, characters, and cameras in real-time.
When we take a look at Sequencer we can see it offers us many options to control the digital environment. For example we can move objects, set visibility, trigger animations and even swap materials.
But sometimes these options are not specific enough for our needs, and this is when the ability to trigger bespoke gameplay comes in handy. So, how do we go about this?
Step One: Create Blueprints to store this Bespoke Logic
The Sequencer can’t trigger any gameplay if none is set up in the first place!
A Level Sequence has the ability to bind to Blueprint Functions and Events through utilising its Event Track and Director Blueprint. As well as this the Sequencer can also manipulate custom Variables within Blueprints so keep this in mind when setting up your logic. We’ll go through how to do this in detail in the next step.
For example, for this tutorial I will be using a Blueprint Actor of a phone. Within this phone Blueprint Actor I have a Widget Component.
It is within the Widget Class Blueprint that I store my logic:
- An Event to play an animation of a dot bubble at the bottom of the phone screen to mimic somebody typing.
2. A Function with a Text Input Parameter which will be used to update an Array of Text Messages that get displayed to the screen. The new text from the Input Parameter gets inserted to the top of the Array, pushing the others down an index to have them visually move upwards on the screen.
However, the Sequencer will not have access to what Widget Class that this Widget Component is using when it tracks the phone Actor Blueprint so I have set up Events on the phone Actor Blueprint itself to cast to the Widget Blueprint and call its Event and Function. It is these Events that I will trigger from the Sequencer:
UpdateTextMessage: Sends a new message to the phone via a Text Input Parameter.
DotsAnimVisible: Plays the dots typing animation.
I will not dig too much further into the specifics of this Blueprint but if you’d like a more in depth look at how I created the phone Blueprint Actor then do let me know :)
Once you have your logic is set up and working then it’s time to connect it to Sequencer!
Step Two: Create Sequencer
Make sure to add a Level Sequencer to your level if you haven’t already. You can do do by right clicking in your content browser and finding it under the Animation section. Once you have created it then left click and drag it into your Level.
Once you have done this you can then add the Actor to your Sequencer to track it through the timeline. An easy way to add any actor is by having it selected in the Editor Window or the World Outliner and then pressing +Track on the Sequencer Tab and hovering over ‘Actor to Sequencer’. Note how the Actor you have selected is already up the top of the list.
To preview gameplay that needs the game to be running (such as widget animations) then you’ll also have to set the Sequencer to play when the game begins. You can do this within the Level Blueprint by hooking up your Level Sequence to Play on BeginPlay.
Note: Don’t forget to unplug the Level Blueprint call to run your Sequencer when you Export your Cinematic as Exporting automatically runs the game so you’ll be running it twice which will make for one unhappy computer!
Once you have added your Actor to your Sequencer then you’ll have access to many features by pressing the +Track on it. However, you’ll notice that the Events we have created are not present yet…
Step Three: Bind to Logic in Blueprint Actor via Sequencer
I will show you a few different ways that you can use the Sequencer to trigger bespoke gameplay through Blueprint Actors. Which ones you might want to use is up to your own personal needs.
1. Control Blueprint Variable from Sequencer
Perhaps all you need it to be able to update a variable from inside your Sequencer? This could be useful for visual changes such as changing the colour or light intensity of an object.
For my phone example I am using a Material on the Mesh.
Within this Material there is a Scalar Parameter value which controls its Emissive Intensity by multiplying the Emissive Colour by it. Material Parameters allow users to easily update the values to change the Materials look without having to re-compile (More on how to set up Emissive Materials here). If I decide I would like to control this Emissive Intensity through the Sequencer to have it glow brighter and dimmer at certain frames then this is pretty simple to do:
- Within the Actor Blueprint’s Construction Script I can set the Phone Glass to use a Dynamic Material Instance of the phones Material. By creating a Dynamic Material this allows me to then update any Scalar Paramaters dynamically.
- I can then set up a Float variable called EmissiveIntensity and hook this up to the node Set Scalar Parameter Value for the Dynamic Material Instance I have created.
- In the details panel of this new Variable I need to tick ‘Instance Editable’ and ‘Expose to Cinematics’ to allow the variable to be modified through our Sequencer.
- In the Class Settings of my Actor Blueprint I need to tick ‘Run Construction Script in Sequencer’ to allow the Construction Script to run as I scrub through the Sequencer timeline so I can see the changes in real-time.
- Back in my Level Sequencer I can click on the +Track next to my Actor Blueprint that I added earlier and now I should see the new variable ‘EmissiveIntensity’ in the dropdown under ‘Properties’.
- Clicking on this adds the EmmissiveIntensity variable to my track and there I can keyframe the value in the timeline. The phone Actor Blueprint will update its Material in the editor for me to preview as I adjust the variable which is super handy.
2. Trigger Blueprint Actor Function or Event from Sequencer
Perhaps you want to trigger custom Events or Functions from within that Blueprint? This is useful when you want control over more complex logic for example my custom widget animation to mimic when somebody is texting on the phone Actor Blueprint.
To trigger custom Events or Functions from Blueprint Actors that we have added to the Sequencer we must add an Event Track. To do so press +Track next to the Actor in the Sequencer and then choose either Trigger or Repeater Event. This will create a new track called Events.
What is an Event Track?
Event Tracks allow you to define points in your cinematic where you want to execute some form of scripted functionality. A Trigger Event track is used to trigger a specific event at a specified frame during the timeline. A Repeater Event track is used to add a new section that triggers an event every time its evaluated.
For this example I will be using a Trigger Event track:
- Once you have created this Event track you can then keyframe a Trigger Event which you can then bind to the Blueprint Actors Event or Function by right clicking on the keyframe and choosing Properties > Unbound > Quick Bind > Class > ‘BlueprintActor’ >
In my example below I am binding to my ‘DotsAnimVisible’ Event.
- Once you have done this you will have automatically created an Event Endpoint and will be taken to it within the Director Blueprint. You can also locate the Director Blueprint by clicking on the Blueprint icon in the top bar of the Sequencer or by right clicking on your Keyframe and opening your Key Event Properties and clicking the magnifying glass icon next to your Event.
What is the Director Blueprint?
Each Level Sequence has its own Director Blueprint, containing all the logic for the Events in that Sequence. From here you can add additional logic from the Event Endpoints within your Event Track. Event Endpoints are basically just Events made within the Director Blueprint that are triggered via the associated keyframe. It’s also possible to create Variables within the Director Blueprint, just like you would any other Blueprint. You can then pass on these variables and object information throughout the script and to other Actor Blueprints that you bind to within the Event Track.
My Event Endpoint is automatically set up to trigger the DotsAnimVisible Event from my Phone Blueprint Actor so if I will see this animation get triggered if I play in editor.
As explained in Step 2: You cannot preview gameplay that requires the game to be running (such as widget animations) just by scrubbing through the Sequencer, you must make sure that the game is being run in editor (I choose to simulate) and that the Sequencer is set to play within the Level Blueprint.
After setting up a specific Event Endpoint in the Director Blueprint you can bind new Event keyframes to use the existing one:
- To do this create a new keyframe within that same Event Track.
- Right click this new keyframe and choose Properties > Unbound > Quick Bind > This Sequence > Call Function > and choose the name of the Event Endpoint you have already set up. In the example below you can see I have a function Phone Blueprint Dots Anim Event available for me to bind to.
3. Pass Information from the Sequencer to a Blueprint
Perhaps you need to pass information to your Blueprint Actor? This is helpful for when you need to update information along with triggering bespoke logic, such as for my UpdateTextMessage Event where I need the phone to display a new text message from a Text Input Parameter. Well, you’ve done the hard part, now this bit is easy!
Using the same method as before, bind to an Event or Function which requires an Input Parameter. In the Director Blueprint you will see that this will automatically be set up and connected to your Event Endpoint. For example, when I bound to my Phone Blueprint Actor’s UpdateTextMessage Event it automatically set an Input Parameter of the same Text value to the Event Endpoint which is already hooked up to feed the information through to the event call.
To change the value of this Input Parameter:
- Right click your keyframe within your event track that’s bound to an even with an input parameter.
- Hover over Properties and look under Payload. Here you should find your variable to input.
- Make sure you press enter if you’re writing in a text field or else it won’t save.
Note that in Properties there is also an option to call the trigger in editor. This might work for some bespoke events, however for mine they still needed to be run in PIE (Play in Editor) for me to preview them so I’ve kept this option unticked and am relying on my call for the sequencer to be played whenever I run the game. (Reminder: don’t forget to unplug the Level Blueprint call to run your Sequencer when you Export your cinematic)
4. Create Bespoke Logic within your Sequencer
What if you want to trigger certain logic from a keyframe that isn’t inside another Blueprint? This could be useful for you to add functionality that otherwise could be keyframed into this event trigger to make your work more efficient. E.g. to trigger some visibility or movement change after a keyframe has been triggered.
In my previous examples I was binding through the phone Actor Blueprint because this already had events that got a reference to the Widget Component Class its Widget Component was using, however we could also do this within the Sequencer. Let me show you how!
- By pressing the +Track next to my phone Blueprint Actor in the Sequencer I can see that it also allows me to track this actors Components. By clicking Widget it will add a track that is indented below my phone Blueprint Actor.
- I can create an Event Track for this Widget Component, however I will not be able to see any Events or Functions within the Widget Blueprint because the Sequencer isn’t able to access what Widget Class the Widget Component is using. Instead I need to create a new Endpoint that I will set up this reference from within our Director Blueprint.
- Within the Director Blueprint I can then cast to the Widget Blueprint class and store this reference as a variable before then directly calling its events and functions, just like I had set up previously in the phone Actor Blueprint.
- Along with this I can also add new logic and manually add new Input Parameters to my Key Endpoint Event. Below you can see that I am using a Timer with a Float Input Parameter to manually set the Time value so that I can tigger both the Dots Animation and Update Text functionality with some delay in between to make it appear as if someone is typing before they send the message.
🎉Now you know how to manipulate the Sequencer to bow down to your bespoke demands! 🙌
If there is anything that I have missed about the Sequencer and its ability to trigger Gameplay then please do share it with me, just like you I am constantly learning and sharing my findings in the hopes that I can continue to learn while helping others :)
I hope this was somewhat insightful and hopefully educational for you and I wish you the very best for your creative projects ❤
If you’d like to check out more of my work or what I’m up to then you can follow me on YouTube, Twitch, Twitter or Instagram @YagmanX . I also have a free horror game ‘Perfection’ on itch.io and a music EP ‘Sweater’ available on all major music streaming platforms :)