Introduction to Timeline in Unity

Hernando Nieto Jaramillo
5 min readJul 10, 2021

--

Timeline is used to create cinematic content, game-play and audio sequences, and complex particle effects; camera cuts, pan, and animation tracks to hide and activate game objects.

To activate Timeline go to Windows/Sequencing/Timeline in Unity editor.

For more info about Cinemachine, you can read this blog: Creating shots for cut scenes with Cinemachine

At this point, a cut scene with 2 Cinemachine virtual cameras is done.

To create a new Timeline asset, it is very similar to animations: select a gameobject (in this case, SleepingGuardCutScene) and click on “create” in Timeline tab. It will create a “Playable Director” component.

The Playable director controls when the Timeline asset is enabled and placed.

Rigth now the playable director has Game Time as Update method and Play On Awake is active

Through code we will deactivate the sleeping guard game object and activate the SleepingGuardCutScene. When that happens, the Timeline asset will be played

Cut scene deactivated
Cut scene activated
Cinemachine virtual camera view

To start animating between cameras, Timeline will ask for a Cinemachine brain. It is a component added to the Main Camera automatically when creating a virtual cam.

Drag and drop the Cinemachine Brain from the Main Camera

Change the time from frames to seconds

Select the cinemachine track (Main Camera — Cinemachine brain. it will create a blue selection), right click, Add Cinemachine shot

With the CinemachineShot selected, choose its virtual camera for both

For now it will execute the second shot right after the first one is finished, but it doesn’t look very well. So, we can move the second shot through the first one and it will create a blend for both.

Timeline Animation Track

The Actors game object contains the required Animator. Drag and drop to Timeline (where it says None(Animator)).

Later, add the GetCard animation

You can hit play in Timeline tab to preview the changes

Deactivating game objects

  • Right click, Activation track
  • Choose the card in hierarchy and drag it into the activation track

You can modify the moment for deactivating the game object. In my case, 3 seconds

Click on play in Timeline to preview changes.

Camera fade to Alpha

  • Create a UI/Image in hierarchy. You can name it CameraFadeAlpha
  • In hierarchy, select Canvas.
  • In inspector, select Canvas Scaler. Set the UI scale mode to Scale with screen size.
  • Change the CameraFadeAlpha color to black
  • With the anchors selected, click on the bottom right one (yellow square)
  • Set its values to 0

Now the game tab must appear in black.

  • Create an animation track in Timeline. Add the CameraFadeAlpha game object.
  • Select “Create Animator on CameraFadeAlpha”
  • Click on record button on this animation track (Timeline cursor must be in the first frame)
  • Select the CameraFadeAlpha in hierarchy, move the Alpha channel a bit and return it to 255 just for start recording
  • Place the Timeline cursor on the moment to show the screen again. I chose 1:00 (1 second).
  • Click on play in Timeline to preview changes

--

--

No responses yet