Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

TrackMixer not created if track has no clips or curves

Discussion in 'Timeline' started by Goooooooogle, Mar 11, 2020.

  1. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    I understand this is probably by design to be efficient, but is it possible to expose CanCompileClips() to public so that we can create a TrackMixer for our custom TimelimeTrack even when there is no clips? Or is there another way of doing this?

    We are trying to make our track mimic the behaviour of ActivationTrack i.e. run some disable logic from the mixerPlayable when there's nothing on the track.

    Thanks

    Edit: I tried implementing my disable logic in GatherProperties as a workaround, which does the job in the editor, but won't work in the build or play mode.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,194
    Right...the API doesn't seem to provide a good way to tell timeline to compile an empty track.

    There's another option you can use right now (assuming you are on 2019). Embed a hidden animated property into your track. Timeline will compile the track if it has an animated property. Something like the following.

    Code (CSharp):
    1. class MyCustomTrack : TrackAsset
    2. {
    3.     [Serializable]
    4.     class DummyProperty : PlayableBehaviour
    5.     {
    6.         public float dummyValue;
    7.     }
    8.    
    9.     [HideInInspector]
    10.     public DummyProperty template = new DummyProperty();
    11. ....
    Granted this is an odd workaround, but would unblock you in the short term.
     
  3. Goooooooogle

    Goooooooogle

    Joined:
    Sep 30, 2016
    Posts:
    11
    One caveat for folks who want to use the same hack - Just creating a dummy property is not enough. It has to have keys on the curve, otherwise it still won't compile.
     
    seant_unity likes this.
unityunity