Search Unity

Question Using Timelines for Cutscenes. Should I use a seperate Director for each cutscene?

Discussion in 'Timeline' started by Splosions, Dec 8, 2022.

  1. Splosions

    Splosions

    Joined:
    Apr 29, 2017
    Posts:
    30
    I have a director in my scene. I made a test timeline with a player model, 2 seperate animators, and an activator track.
    All the bindings show the different gameobjects and animators from the timeline.
    If I remove the timeline from the director, clear out the bindings left over, and put the timeline back into the director...the bindings all come back but are all blank!? Why do the timeline objects not store the bindings they are created with?

    Does this mean if the timeline does not use the exact same bindings as a previous timeline it needs to go on a seperate director?

    Do I need a separate director object in the scene for every timeline I create?
     
  2. superarhow

    superarhow

    Joined:
    Mar 24, 2015
    Posts:
    5
    Hello, the timeline is an asset, which stores directly on the disk so it can only directly reference the other assets, not those objects in a prefab or in a scene.
    If you open a scene or a prefab in text mode, you'll see objects referencing each other using something like "fileID":

    ...
    objectReference: {fileID: 1982905225}
    ...

    And the game object with the fileID will be stored as below:

    --- !u!1 &1982905225
    GameObject:
    m_ObjectHideFlags: 0
    m_CorrespondingSourceObject: {fileID: 0}
    m_PrefabInstance: {fileID: 0}
    m_PrefabAsset: {fileID: 0}

    The fileID is guaranteed to be unique only in the same prefab or in the same scene. So it cannot be some object in another scene or in another prefab.

    What PlayableDirector is doing is just make sure it is saved in the scene or in the prefab which contains all the objects the timeline is referencing. And before it start playing, the PlayableDirector lookup the saved objects table and set the references to the clip which created using the timeline's asset (so called bindings).

    So to make a timeline's binding correctly saved, you must using a PlayableDirector saved in the scene or in the prefab, and make sure all the references of the timeline are objects in the scene or in the prefab.