Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to create settings on Track-level that can be properly synchronized when read in the Mixer?

Discussion in 'Timeline' started by Keepabee, Mar 10, 2021.

  1. Keepabee


    Jul 12, 2012
    I have a track-wide setting "EvaluateInEditMode" which controls whether the Mixer should evaluate clips during Edit Mode.

    I can either have this variable directly on TrackAsset and pass it onto MixerBehaviour during CreateTrackMixer, after creating the MixerBehaviour, but this is one-directional and one-time-only; if I now edit the Timeline and change the value on the Track's Inspector, it will not affect the already-created Mixer before closing the Timeline Window and re-opening it (or switching viewed Timeline, etc., anything that re-creates the graph, hence Track and Mixer, now getting the updated Track value injected to the Mixer).

    I thought the "template" pattern of doing things was meant to solve this problem, but apparently it also passes the template only once from Track to Mixer on Mixer creation inside CreateTrackMixer, so it's just the same. For reference, by "template pattern" I mean setting the MixerBehaviour class as [System.Serializeable] and having a

    Code (csharp):
    1. [SerializeField] private MixerBehaviour template;
    in the Track class members and then in CreateTrackMixer passing that template into the Create method:

    Code (csharp):
    1. ScriptPlayable<TimeSkipMixerBehaviour>.Create(graph, template, inputCount);
    How to create settings on Track-level that can be properly synchronized during editing on the Mixer level? I want it to work while editing in Edit Mode and toggling the option on Track Inspector; so that you don't have to jump between Timelines/deselect-and-reselect the Timeline GameObject in Hierarchy for the option to update in the Mixer instance.
    Last edited: Mar 10, 2021