Search Unity

Question Modify timeline instance via code but not the asset

Discussion in 'Timeline' started by RINNUXEI, Dec 14, 2022.

  1. RINNUXEI

    RINNUXEI

    Joined:
    Sep 3, 2015
    Posts:
    32
    Hey, when I tried casting PlayableDirector.playableAsset to TimelineAsset and play with its tracks, say, mute the track or something, the timeline asset is also modified even in play mode.

    Can we temporarily modify a timeline instance during runtime via code just like the relationship between prefabs and prefab instances?
     
    mandisaw likes this.
  2. Camisado32

    Camisado32

    Joined:
    Jun 16, 2016
    Posts:
    5
    PlayableGraph is a runtime product of the TimelineAsset that you can get from PlayableDirector.playableGraph. I am not too familiar with modifying it but my understanding is each track in the timeline has an associated PlayableOutput struct from the PlayableGraph that you can modify. I believe the PlayableOutput.GetReferenceObject() holds a reference to the TrackAsset that generated it so you can loop through them and find the output you are after that way.

    Hopefully that gets you going in the right direction.