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’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

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?
     
  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.