Search Issue Tracker

By Design

Votes

0

Found in [Package]

1.8.6

Issue ID

TB-257

Regression

No

Custom PlayableGraph stops working when making edits in the Timeline window

Package: Timeline

-

Reproduction steps:
1. Open the attached “BugRepro” project
2. Open the “SampleScene” Scene
3. Select the “DefaultHumanoid” GO in the Hierarchy window
4. Move the “Timer” slider under the “NewBehaviourScript” component in the Inspector window
5. Open the Timeline window (Window > Sequencing > Timeline)
6. Select the “PlayableDirector” GO in the Hierarchy window
7. Change the current frame by sliding in the Timeline window
8. Reimport the “NewBehaviourScript” script in the Project window
9. Repeat steps 3-4
10. Observe the Game View

Expected result: The animation starts playing
Actual result: The animation is not being played and the “DefaultHumanoid” is stuck in the “T Pose” animation

Reproducible with: 1.7.0 (2021.3.32f1), 1.8.0 (2022.3.14f1), 1.8.6 (2023.2.1f1, 2023.3.0a15)

Reproducible on: Windows 10
Not reproducible on: No other environment tested

Note:
- After closing and re-opening the project, the issue gets fixed

  1. Resolution Note:

    This issue happens on domain reload in the Editor because of multiple factors:
    Usually when previewing in the Editor, when creating the PlayableGraph, Timeline will add a Default Pose clip (T-pose) and Default Generic Properties clip as inputs of the AnimationTrack's Layer Mixer to provide a fallback to blend with.
    Those Default clips are not serialized and are created only when opening the Timeline Asset in the Timeline Window.
    Secondly when Timeline creates its own AnimationPlayableOutput it adds a WeightPostProcess callback to them which will manage the clips weight for both Layer Mixer and Mixer.

    When you create your custom graph for the first time using TimelineAsset's CreatePlayable the TimelineAsset has not been opened yet in the window.
    Consequently the default clips do not exist and are skipped in the Graph creation. With only one clip in your Mixer you do not have any issue.

    However once you open that Timeline Asset in the Timeline Window, the default clips are created.
    Next time an Assembly reload happens and your custom graph is destroyed, it will be rebuilt with 3 inputs to the Layer Mixer.
    The obsolete Play method you are using creates a simple AnimationPlayableOutput without any of the Timeline callbacks, meaning your graph is evaluated correctly but the T-Pose overrides your clip in the Layer Mixer because the weight management callbacks do not happen.

    To fix this, you first have to make sure to call TimelineAsset.CreatePlayable with an empty PlayableGraph, this will ensure it creates its own AnimationPlayableOutput with the required callbacks (if there are any playables in the graph the output creation is skipped).
    Then you can insert your custom ScriptPlayable in between TimelinePlayable and its output.
    Make sure the output targets your Animator as it won't have a target.
    As using the obsolete Play method will create another output that you will need to prune. I suggest using reflection instead to invoke PlayableGraph.SyncUpdateAndTimeMode from your Monobehaviour directly if you need it.
    That will ensure you have all the callbacks necessary to handle the preview graph and you should no longer be seeing an issue when rebuilding after opening your TimelineAsset with the Timeline Window.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.