Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Control Track rebuilding Controlled Director

Discussion in 'Timeline' started by TheHeftyCoder, May 22, 2022.

  1. TheHeftyCoder


    Oct 29, 2016
    Hello, I've come to a point where I want to dynamically change a playable graph after it has been created. Specifically, I want an audio clip playable to play a different clip. I've managed to get the audio clip playables from the generated graph and change it. The thing is, though, that I cannot manage that state, since I do this in a director that is being controlled through another timeline.

    The result is that the controlled director rebuilds its graph the first time ProcessFrame for DirectorControlPlayable is called (specifically, SyncStart) That reverts all the changes I've made to the graph, since it's rebuilt.

    I can avoid this by instantiating the TimelineAsset and changing stuff there, but I wanted to avoid Instantiation, since it's a waste of performance. Currently, though, it's my only choice. A better solution would be appreciated, if anyone has any idea how to better approach this.

    EDIT: It seems that instantiating the timeline at runtime doesn't make a copy of the tracks and clips as well, but rather uses the old ones. Great..! What is this behavior...

    EDIT2: You should be able to do this on your own with a combination of CreateTrack, CreateClip and using JsonUtility to pass the copies.
    Last edited: May 23, 2022