Search Unity

Insert custom playable between Timeline and TrackMixer

Discussion in 'Timeline' started by zander_m, Mar 4, 2019.

  1. zander_m

    zander_m

    Joined:
    Feb 7, 2019
    Posts:
    15
    The branches of a playable graph representing a standard Animation Track contain nodes like AnimationOffset and AnimationMotionXToDelta, the latter being inserted between the Timeline playable and the AnimationLayerMixer itself.

    Is there any way to create a similarly structured graph when building custom tracks in Timeline?

    The "mixer" playable returned from an overridden CreateTrackMixer automatically has it's output connected to the Timeline playable and it's inputs connected to the playables representing the clips to be blended. There doesn't appear to be a way to specify separate playables for these Director managed input/output connections, or any way to override the methods where these connections are made.

    Is there an appropriate spot to reliably inject an extra playable between the Timeline and the Mixer (similar to the MotionXToDelta node) that will properly re-inject whenever the Timeline graph is rebuilt?


    In our specific case, we're doing this to try and emulate a custom PrepareFrame step on an AnimationMixer/AnimationLayerMixer being inserted into a custom track with an AnimationPlayableOutput.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    That's a very insightful question - your assumptions about the mixer playable are correct, and the answer is, unfortunately no. I can't think of a way to re-create the animation structure. That's definitely an oversight.

    What you could do is create your mixer with inputCount + 1 inputs, and add your custom playable to the last input. Make sure to set the weight to 1 as well, and you will get a prepare frame call - although it will occur after the actual clips are prepared.
     
    zander_m likes this.