Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Should I use Timelines for this use case?

Discussion in 'Timeline' started by Schneider21, May 23, 2017.

  1. Schneider21


    Feb 6, 2014
    In my current project, I have a system of event windows that pop up on the screen. This window has a render texture that will show a little "scene" playing out while the player reads the event text and, eventually, chooses an option by clicking one of the buttons in the window.

    Each "scene" has its own set of geometry and characters (empty controllers that have their models loaded in based on parameters), but I'd like to have global things as well such as lighting and cameras, if possible.

    My intent is to have these "scenes" be loaded in, play an Intro animation and transition into a Looping animation. That looping animation will play until the player clicks one of the buttons, at which point we transition to the Outro animation. When the Outro completes, the event window closes and gameplay continues.

    I've been peeking a bit at Timelines and thinking this is a good way to handle the animating part of all this, but I'm very unclear on how to properly implement them in the system I'm trying to build. Would I need 3 separate Timelines (Intro, Loop, Outro) that are handled by the same director, or is this all handled by a single director? And how would that work if I wanted 3 separate Outro clips that were chosen depending on the player's choice? Should I have a global director (for all "scenes") that I pass an appropriate Timeline to as decided from a custom script?
  2. julienb


    Unity Technologies

    Sep 9, 2016
    When you setup a director component, you have to give it a Timeline asset, but you also have to specify the tracks' bindings. For example, if your Timeline asset contains an Animation Track, then the PlayableDirector component is responsible for mapping this track with a GameObject in your scene. (Not all tracks need a binding though).

    With that in mind, I would suggest to have one PlayableDirector per Timeline. I will be easier to edit your timelines this way, since you will not need to re-bind your tracks each time you want to make a change. However, nothing prevents you from having a global director, as you can change the Timeline of a director without any problem. Either way, it will work; it's a matter of choosing what best fits your workflow.