TIMELINE MANUAL

Revision history

INTRODUCTION

Timeline is a new tool that allows the creation of cutscenes, gameplay sequences, complex particle systems, and a multitude of other gameplay elements that need to be organized and played back as a sequence of events. It is implemented as a Unity Extension.

This manual is using the alpha version of the Timeline tool, as part of the Unity 5.6 BETA release. A public experimental build / beta is scheduled around the end of the year, 2016, with subsequent releases leading toward the final release (TBD).

Some of the information in this manual is therefore subject to change.

  1. TIMELINES

As stated above, the Timeline Editor is a tool to create and playback timelines. These timelines are implemented as assets, just like animation clips, textures or other Unity resources.

Timeline Asset

Timelines being external assets is an important aspect of the Timeline editor. This means that, to playback a timeline, it must be referenced by a special Component in the scene, just like the Animator references a Runtime Animation Controller. This means that the same timeline can be played multiple times in the same scene. For a single cutscene this might not seem useful, but as you will see, you can create gameplay elements (such as particle systems with sound) that could be reused several times in your game.

Another useful aspect of working with assets, is that as we will see below, timelines can reference other timelines. This promotes collaboration by allowing many people to work on parts of a big, master timeline. Just like any other built-in asset in Unity, you can create a Timeline asset via the Asset menu

Playable Director Component

To playback timelines, a new Component is required: the Playable Director component.

This component controls when the playback should start, at which time and how should it advance its clock.

The Playable Director component can also be used via scripting. This can be used to dynamically start and stop sequences from game play code.

Example:

2. USING TIMELINE

2.1 THE TIMELINE EDITOR

The Timeline Editor window is accessible via the Window menu.

The various components making up the Timeline Editor

Tracks and Groups

Animation Tracks

Timeline allows you to sequence animation clips together using an Animation Track to animate game objects in the scene. You can create an animation track in one of two ways:

  1. Drag a Game Object from the hierarchy onto the timeline and select "Animation Track".
  2. Select "Animation Track" from the "Add" track button. Then drag the object you want to animate to the track binding field.

Animator components are required on game objects animated by Timeline.


Animation Clips

To add an animation clip, either:

  1. Drag and drop an animation clip onto the track.
  2. Select “Add From Animation Clip” from the track menu

Scrubbing the playhead will allow for previewing the animation clip in the editor.
Note that it is also possible to create a new animation clip within Timeline. For more information refer to the Recorded Animation Clip section.

Multiple clips can be placed on a track to create a sequence of animations.
Override Tracks can be added using the Track options menu, to allow layering of animations.

Audio Tracks

Timeline supports any number of audio tracks. Many audio tracks can be layered together to create a complete mix.

You can create an audio track in one of two ways:

  1. Drag an audio file asset or an audio mixer from your project window onto the timeline.
  2. Select "Audio Track" from the "Add" track button. Then you may bind an audio mixer as a track binding or leave it at none.

Audio Clips

Clips can be added in two ways:

  1. Drag an audio file asset from your project window onto the audio track.
  2. Select “Add From Audio Clip” to select from a list of available audio files.


One of the most powerful features of Timeline is that it is built on a completely open architecture. Animation, audio and Playable tracks are built entirely in C#, using the same APIs available to users. This means that it can be extended in a myriad of ways.

Imagine making a game that has a complex UI made up of UI element transitions (like panels fading in and out, buttons sliding in and out, etc.) Or perhaps you game needs a flexible character dialogue system where text, sound and animation is mixed together. Or even, perhaps you’d like to create a set of timeline clips that control a camera procedurally.

Timeline allows you to, not only create custom clips using C#, but also allows you to create entirely new types of tracks.

Activation Tracks

Activation tracks are used to turn Game Objects On and Off.
You can create an activation track in one of two ways:

  1. Drag a Game Object from the hierarchy onto the timeline to create a track and bind it.
  2. Select "Activation Track" from the "Add" track button. Then you may bind a Game Object to it.

        Activation Clips

An activation clip is automatically added to new Activation tracks.

Additional clips can be added by:

  1. Drag an audio file asset from your project window onto the audio track.
  2. Select “Add Activation Clip” to add a new clip to the track.

Cinemachine Track

Cinemachine works with it’s own track type in Timeline.   The Cinemachine Track contains Cinemachine Shot Clips which trigger the virtual cameras

Installing Cinemachine

Cinemachine is not packaged with Timeline in Beta.  It is provided as a separate package you’ll need to install, available from the Timeline Preview Content Folder, located here:

Download Cinemachine Unity Package 

After installing the CM package, Create Virtual Camera sets up the virtual Cinemachine camera environment.

You’ll see a little CM icon has been put on the Main Camera.  This is the CM ‘brain’ which handles all the virtual camera blending and cutting.

Right click on the left of the Timeline window OR hit Add to create a Cinemachine Track

This is the track which you’ll put all the cuts (or blends) to the CM virtual cameras.   You can go between non-Cinemachine and CM cameras but if you want to take advantage of everything CM can do, it’s best to stay within that environment.

Once you have a CM track, you need to point it to a Unity camera like the default Main Camera. OR you can simply drag a Cinemachine brain equipped Main Camera down to Timeline and it will create a CM track for you,


Right click on the Cinemachine Track to create a Cinemachine Shot Clip

Here’s the CM track with a number of shot clips. Note that if you overlap the clips the cameras will blend. Shot 1 to Shot 2 is a cut. Shot 2 and Shot 3 will blend over their amount of overlap. This is a very powerful way to animate different desired shot compositions together.

When you select a Shot Clip on the CM shot track, it shows the clip inspector.  You can create a new virtual camera by hitting Create or drag any CM virtual camera into the slot.

Please refer to the CM documentation included in the package for more information on how to use a Cinemachine virtual camera.

Clips

Each type of track is associated with one (or more) type of asset that can be “dropped” on to create a timeline Clip.

For instance, the Animation track accepts animation clips, and audio tracks accepts audio clips.

You can use the track’s contextual menu item “Add From [...]” to open up a object picker to choose from a list of compatible assets that can be used on the track. Once you’ve chosen a compatible asset, this asset will be inserted on the track at the position of the playhead. The new clip length will automatically be set to the asset’s duration.

For animation and custom playable tracks, it might make more sense to create a new asset instead of fetching one from the disk.

Blending clips

When two clips overlap each other on a track, these two clips are said to “blend” together. When this happens, Timeline automatically create ease-in and ease-out curves to control how the 2 clips will smoothly blend together when played back. (note that you can customize and fine-tune these blends via the Inspector, see below)

The image above shows two audio clips blending together, and both clips now have ease curves.

Blending will mean different things depending on the type of track. For audio clips, this means their “volumes” will fade in (and out). For animation clips, it will control the “weight” of the particular animation clip.

Inspectors

Clicking on a clip will display its properties in the inspector.

For properties that represent a time, the values can be edited in either seconds (s), or frames (f). When editing in seconds, the values are not restricted. When editing in frames, partial frames will be displayed, but only integral values are allowed as input. The values affecting time are

Blend Curves

As described above, when two clips overlap blend curves are automatically generated for each curve. By default, ease-in and ease-out curves are used. You can customize the curve by changing the curve from “Auto” to “Manual”, and then clicking the curve. A curve editor will pop up in the preview window below the inspector

Here you can select different presets or edit the curve manually.The editor will enforce that all blend in curves end at 1.0, and blend out curves start at 1.0.

Ease In/Out

The Ease In and Ease Out properties permit specifying a blending in and out where no overlap occurs. These values can be set in the inspector. However, if a clip becomes overlapped, the overlapped time takes priority. In the example below an override track uses a clip with custom ease in and ease out values to smoothly transition to and from an overriding animation clip.

Extrapolation

Animation Tracks are a good example where extrapolation is supported. When playhead is scrubbed to a time where no clip exists, the Timeline automatically sets clips in Hold mode to avoid an undesirable bind pose. Using extrapolation we can change the behaviour in these gaps based on the closest clip.

Extrapolation repeats the clip until another clip appears on the track, and does so by manipulating the local time of clipExtrapolation.png

The options for how it repeats are:

To illustrate the difference between Loop and Continue, when the clip contains a non-zero Clip In value, it will be respected by Loop, but Continue will repeat the source clip from 0.  

Gaps will use the post-extrapolation option of the leftmost clip. If the gap occurs before the first clip, then it will use the pre-extrapolation option of the first clip. The following example shows a clip that will hold the first post in the time leading up to the clip, and loop the clip in the time after the clip.

Sequence Playback

There are 2 ways to playback a timeline: in-Editor and in Playmode.

In-Editor Playback

Timeline: Object Control and Release

The Scene Window shows the effect all active timelines have on all the objects bound to them. Use the timeline switcher to switch between timelines or select “none” to create a new sequence on any Game Object who doesn’t already have a Playable Director component.

Scrubbing

Moving the playhead positioner allows the user to preview the effect of the timeline on the objects in the scene.

Preview Playback

Turning on the play button (Space bar) in the play controls menu will launch a preview of the current sequence in the Scene view window. Playback will begin from the playhead's current position. Behaviour of the sequence playback once it reaches the end of the sequence is defined under the Director Component's Wrap mode setting:

Play Range

Users may also define a specific range of frames to be played back.
Play range is enabled by turning on the Play Range button next to the playback controls.

When Play Range is enabled, two brackets are shown on the timeline defining the range of frames to be played back.  All timeline elements outside of the brackets will be ignored until Play Range is turned off. Users can reposition the brackets to fit their playback needs. Turning off the Play Range button releases the playback constraints.

 


The Director Component's Extrapolation setting (Hold, Loop, None) defines the behaviour of the Play Range playback once it hits the end bracket.

Playmode

While in Playmode, timelines are controlled via their Playable Director components.  However, the Timeline window can “interact” with a playing timeline by controlling the time (using the playhead) or stopping / resuming a timeline being played in the game.

This is useful for taking over a timeline currently playing in the game for debugging purposes.

2.2 MODIFYING CLIPS

Clip selection

Single clips are selected by clicking anywhere on the desired clip.  Timeline lets you know that the selection is active by displaying a white border and colour highlight on the selected clip. You may also do a multi-selection by using the modifiers “Shift + click” to multi-select a range or “Ctrl + click” to multi-select clips independently.

Moving clip(s) in the time

A clip’s position on the timeline can be changed by dragging a selected clip or a multi-selection of clips to a new position along the timeline.  When the clip being grabbed encounters another clip, a blend is created.

Moving clips using Tiling

It is possible to remove all gaps between a multi-selection of clips by choosing Align->Tile for one of the clip’s contextual menu.  When tiling, the first clip’s position remains the same while all the following clips are lined edge to edge, removing any gaps between the clips in the process.

 

Moving clips to a different track

A selected clip or multi-selection of clips can be moved to another track of the same type by dragging them vertically to the other track. A ghost of the clip appears in the new location to help the user understand the effect of the move.

Duplicating clip(s)

A selected clip or multi-selection of clips can be duplicated by right-clicking on the clip and selecting Edit-> Duplicate from the contextual menu.  Duplicated clips are automatically added at the end of the current track.

Clip Editing

Trimming

Users can “trim” the length of a clip gesturally by grabbing its start or end edge and dragging.

Users can also trim a clip using a combination of the playhead and the clip’s right-click contextual menu.  To trim this way, first position the playhead on the desired trim area, then right-click on the clip and select Edit -> Trim Start or Edit-> Trim End.  When trimming this way, the portion of the clip before or after the playhead is removed.

Gestural trimming
 

Right-Click trimming

Splitting

A clip can also be “split” in two by moving the playhead to the desired time and selecting Edit->Split from a clip’s right-click contextual menu.  When splitting, the two portions of the clip become separate clips that can be moved and trimmed independently.

Resetting

It is important to note that editing changes are not destructive since users can always go back and gesturally re-extend the clip or revert it to its original state by right-clicking on the clip and selecting Edit-> Reset clip.  Trimming should be considered as a narrowing of the window of view.  All the information remains underneath and available.

Clip Modifiers

Speed Modifier

It is possible to change the speed of a clip by right-clicking on a clip and selecting:


2.3 RECORDING AND EDITING ANIMATION

Recording with Animation Tracks

Recording an object’s position and animatable properties using the animation track.

Users can easily create new animations within the timeline by keyframing the object’s transform parameters or animatable properties.

To record a new animation:


Recording on a Custom Playable track.

Keyframes can also be recorded on any animatable properties in the same way on Custom Playable tracks.

Infinite tracks vs. clip tracks

Infinite tracks are automatically generated when a user enables autokey recording on an empty track.  This is intended to give users an easy way of creating a simple animation without the need to handle clips.  A track may be converted from infinite to clip mode and back again as long as only one clip is present on the track. The ability to switch back and forth is lost when a second clip is added to the track.

While in clip mode, it is also possible to add keyframes to a recorded clip by enabling autokey recording.  A red outline is drawn around the clip to be appended using the playhead’s position.

Editing Keys and Curves

Moving cursor on a keyframe

Sometimes, it is useful to align the time cursor to a keyframe on a clip. Do do so, press ‘,’ to go to the previous keyframe or ‘.’ to go to the next.

Working with In-Line Curves

Understanding In-line Curves


Editing keyframes in the In-Line Curves

Animation Window/Timeline Integration

2.4 ADVANCED FEATURES (TBD)

Compound nesting

Referencing Groups

Working with root motion offset

Externalizing clips

Understanding Playable Graphs

Control Tracks

Understanding Control tracks
Control track options


3. EXTENDING TIMELINE

3.1 Script Playables and Playable Assets

The most common way to extend the Timeline is to create a custom type of clip that can execute user C# code. In Unity you would typically create a MonoBehaviour to do this. When code runs as part of a sequence, we cannot use a MonoBehaviour. This is because there are concepts of the MonoBehaviour that could not be supported inside the lifecycle of a timeline (such as FixedUpdate, OnCollisionEnter, etc.).

Furthermore, code executing as part of a Timeline playback need accurate sequence timing information, which can differ from values in the Time class.

When a Timeline Asset plays, it first generates a PlayableGraph, which is in turn what is executed. The PlayableGraph can be thought of as instance of the Timeline. This is an important distinction, as a single Timeline asset can be played by different players simultaneously. Each player will generate a unique playable graph from the same timeline.

To create a new clip type in Timeline, we first need to define what the behaviour is represented by the clip. This is done by inserting a node into the graph, which is represented by a Playable. C# Playables are known as ScriptPlayables. Let’s start by creating a ‘camera switcher’, i.e. a playable that activates a given camera. This will be useful to create a clip on a track which will act as the current “shot camera”.

OnGraphStart and OnGraphStop are called when the Timeline starts and stops playing. We will use them to store the state of the camera to it’s value before the timeline was played, and restore it once the timeline is finished.


OnPlayStateChanged is called when the clip activates or deactivates on the Timeline, either because of scrubbing or regular playback. In the example, when the state of the clip changes we enabled or disable the camera accordingly.

This is a complete playable and represents the behaviour that we want the timeline clip to represent.

We now need to create a representation of the Timeline Clip. To do this we will create a PlayableAsset. A Playable Asset is a serializable object that acts as a factory for creating playables.


The first thing to notice is the use of the ExposedReference<Camera> type. Because our clip will be serialized as an asset, it cannot refer to GameObjects in the scene directly. The actual reference to the camera is stored inside the Playable Director playing the timeline.

CreatePlayable is called by timeline when creating the PlayableGraph. The CreateScriptPlayable<> calls return a PlayableHandle. GetObject<> will return the newly created ScriptPlayable object. Camera.Resolve(graph.resolver), will retrieve the Camera object for this instance of the graph.

To use the script, create a Playable Track and add clips of your new playable type.

 From there, you can add as many instances of the Camera Switcher on that new track to create shots.

3.2 Playable Animation

3.3 Custom Tracks

The Playable Track allows you to use script playables. You can also create a custom track specifically for your Script Playable type using the custom track template.

In this example, we can specify the color of the track, and the type of playable it supports. The user can now create tracks of this type using the Add menu.

3.4 CUSTOM MIXER

TBD

4. EXAMPLES

4.1 PARTICLES WITH SOUND

The following example demonstrate how to create a particles effects animation using the Timeline

Please download the TimelineParticlesAnimation.unitypackage for the complete example:

And use the Particles Scene from the Example_Scene

RecordAnimationProperties.gif


5. REFERENCES

5.1 Hotkeys / Shortcuts

Note: Hotkeys/Shortcuts are currently being revised and new ones implemented.  
List is highly subject to change.

Action

PC Hotkey

Mac Hotkey

Behaviour

Unity-Wide

Delete

Backspace

Backspace

Deletes selected clip(s) or track(s)

Frame All

A

A

Frames all clips on the timeline

Frame Selected

F

F

Frames selected clips only

Play Controls

Play

Next Frame

Ctrl + .

Ctrl + .

Moves the playhead 1 frame forward

Previous Frame

Ctrl + ,

Ctrl + ,

Moves the playhead 1 frame backward

Next Clip

.

.

Moves the playhead to the next Clip’s start frame

Previous Clip

,

,

Moves the playhead to the previous Clip’s end frame

Go to Start

Shift + ,

Shift + ,

Moves the playhead to the start of the sequence

Go to End

Shift + .

Shift + .

Moves the playhead to the end of the sequence

Timeline Navigation

Pan

Middle mouse button
Or
Alt+ Left click

Middle mouse button
Or
Alt+ Left click

Pan around the timeline without affecting clips

Zoom

Middle wheel

Middle wheel

Zooms in or out

Fast Zoom

Alt + Right click

Alt + Right click

Fast Zoom in or out