Search Unity

Weird preview behaviour of custom AnimatorControllerTrack

Discussion in 'Timeline' started by Jwaybee, May 2, 2021.

  1. Jwaybee

    Jwaybee

    Joined:
    Mar 27, 2020
    Posts:
    3
    Hi everyone.

    My team are trying to combine Timeline and Node Canvas's(a great asset) FSM module into a complete character editing tool. The idea is to assign a timeline asset to each state and adjust the playable nodes' connections and weights when state changes. It seems doable after we spend some time learning the Playable API and how timeline works. Some asmdef/asmref and reflection hacks are unavoidable but we are comfortable with that.

    We are working on the animation tracks at this moment. We have managed to build an custom animator controller track. It is actually pretty easy with the access to the internal stuff. (Make a AnimatorControllerTrack which holds an animatorController and creates a AnimatorControllerPlayable. Make another track, we call it AnimatorControllerParamControlTrack, which creates a ScriptPlayable that get or set the parameters of the AnimatorControllerPlayable.) Here's how looks the editor looks.
    motionEditor.png

    This set up works as expected in play mode and when hitting the play button in Timeline Editor Window. However, dragging the cursor with preview on does not produce any preview.

    I modified the Playable Graph Visualizer Tool to examine this problem. Added some toggles to change a playable node's behaviour. Added a time field under each node to show a playble's local time(Playable.GetTime()). The time field will appear yellow if a node's local time changes(Mathf.Abs(Playable.GetTime() - Playable.GetPreviousTime()) > some small value).

    Whenever I hit the play button, time is properly passed to the end node(the AnimationClipPlayable in the top right corner.) and preview animation is played as expected.
    playableGraph_Play.png

    But when dragging the cursor, all nodes under AnimatorControllerPlayable are not updated.
    playableGraph_Drag.png

    If I set all nodes to propagate time, it shows even weirder results. If I drag the cursor within the animatorControllerClip's range, the end node is not updated, no preview. playableGraph_Drag_inRange.png

    However, If I drag the cursor back and forth outside of the clip's range, the end node is updated and there is actually animation preview produced.
    playableGraph_Drag_outOfRange.png

    Any clues why this happens? It is even possible to get a proper preview when dragging with AnimatorControllerPlayable? Thanks.