Search Unity

Timeline & Its PlayableGraph Behind the Scenes

Discussion in 'Timeline' started by ModLunar, Jan 27, 2018.

  1. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    So I've been using the PlayableGraph Visualizer from the docs to try and understand the structure of PlayableGraphs. Most recently, I've been wanting to understand what kind of graph is generated from a PlayableDirector playing a TimelineAsset, so I made a quick script like this and put it in my scene:

    Code (CSharp):
    1. public class AnalyzeTimelinePlayableGraph : MonoBehaviour {
    2.     public TimelineAsset timeline;
    3.     private PlayableDirector director;
    4.  
    5.     public void Start() {
    6.         director = gameObject.AddComponent<PlayableDirector>();
    7.         director.playableAsset = timeline;
    8.         director.Play();
    9.         director.Pause();
    10.     }
    11. }
    I set the timeline variable in the inspector, and have been creating very simple timelines with barely anything in them to see exactly what parts of the timeline create what parts of its corresponding PlayableGraph. When I play the scene, the PlayableDirector creates the graph when its Play() is called. The graphs mostly made sense until I added a second track:

    Here is the PlayableGraph of a TimelineAsset I made that has 1 Activation Track containing 3 clips:

    PlayableGraph of a TimelineAsset - 1 Track, 3 clips.PNG

    But then I added a second ActivationTrack, and made sure it was empty (containing no clips), and then the graph visualizer showed this:

    PlayableGraph of a TimelineAsset - 2 Track, 3 clips.PNG

    I was wondering, why does the PlayableDirector's graph duplicate like this? Or perhaps is this just something going on with the graph visualizer?

    [EDIT] When I looked at the graph's root playables through code as well, the graph says it has 1 root playable in both cases despite the 2nd graph's "duplicatedness" -- and that 1 root playable is the purple TimelinePlayable in the pictures.
     
    Last edited: Jan 27, 2018
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The graph visualizer is showing the graphs for each graph output. It is not accounting for the fact that timeline has a single root, with multiple outputs.
     
    ModLunar likes this.
  3. Deleted User

    Deleted User

    Guest

    @ModLunar: @seant_unity is right, right now the graph is parsed through its outputs.
    I'm planning on having a better display of the graph in the GraphVisualizer.
     
    ModLunar likes this.
  4. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    Ah okay that makes sense, thank you!

    Oh okay, no worries! Thanks a lot, the tool really helped me understand what was going on with all these playables :p