Activation Tracks Using Timeline in Unity 2020
Activation Tracks in Timeline
The Timeline window supports many different methods of adding tracks to the Track list. Depending on the method you…
Activation tracks are a very powerful tool we can use in Timeline.
We can turn game objects “enabled” status off and on with precise timing in our Timeline sequences.
Note: A better way than putting our Playable Director component directly on the cube game object, would be to create an Empty Game Object and use it as the Playable Director.
You can see the issue in this example with a playable director on a game object whose activation track turns off that game object abruptly ended the entire sequence.
See the end of this article for the fix!
Now, in this example I’ve added a simple activation track for the cube itself as shown above.
If we hit play, we can see the sequence disables cube (and thus our Timeline’s Playable Director) at the appropriate time.
I’ve added a sphere to the scene to add some variety and demonstrate how Timeline activations could create much more nuanced and complex sequences.
We can control the activation of multiple game objects in this single Director sequence.
To make this more apparent, I’ve added a simple animation for the sphere while it is active.
And there you have the completed sequence demonstrating the power of the activation track.
It might be hard to imagine with just a cube and a sphere, but think of the gameplay sequences you could create with these tools.
You can control a cutscene nicely with this but you can also activate game objects you only want to appear in that cut scene and disable them again before the player input is active again.
This can avoid various issues from simple player curiosity.
You can also use this simply to create an effect when you’re not worried about player interactivity.
Imagine the player opens a chest, you activate a particle effect and then disable that particle effect.
Fixing Our Playable Director Issues
We first need to create two new empty game objects, which I’ve named Directors and CubeSphere-Director.
The Directors empty game object will hold all empty director game objects for separate sequences.
In this case, we have just the one but in the future, more could be added as a new empty game object with appropriately descriptive naming.
On the Cube game object, I copied the Playable Director component in its entirety.
I then selected my “CubeSphere-Director” empty game object, added the Playable Director component, and pasted in the values from the existing Cube game object’s Playable Director component.
Lastly, I removed the Playable Director component from the Cube game object.
Now if we hit play and pay attention to our Timeline window, you can see that once the cube is no longer active, the Timeline sequence continues to the end rather than being abruptly stopped due to the cube w/ Playable Director component on it being disabled.