AnimationClipPlayable.SetTime(0.0) fires animation events

AnimationClipPlayable.SetTime(0.0) This function fires two animation events that it should not be firing. I call this function to prepare for another playback after the animation has finished playing. The animation events fire twice for some reason, and I suspect it's because of this function call.

Commenting out this function leads to only being able to play the animation once, but the events also fire only once (expected behaviour). With this line, I can play the animation as often as I please, but at the very start of the animation, the animation events are fired, in addition to their regular timings.

Any clue how to fix this, or temporarily disable animation events from firing?

It also applies root motion between the old and new time, which is sometimes desirable.

If you don't want that, just call SetTime twice in a row.

[quote=“Kybernetik”, post:2, topic: 864184]
It also applies root motion between the old and new time, which is sometimes desirable.

If you don’t want that, just call SetTime twice in a row.
[/quote]
Thank you, it works like expected now. I don’t understand why but at least it works.

Doesn’t this look odd?

        playableGraph.Attack.pAttacks[0].SetTime(0.0);
        playableGraph.Attack.pAttacks[0].SetTime(0.0);

It does, but that's just the way it is. In my system I made a Time property that calls it twice and a MoveTime method that only calls it once.

I'll forward this to the team and see if its a bug or intended as it does look a bit odd to me.

I reported it a few years ago (case 1005591) and got this response (the link to the original case asks me to log into FogBugz but I don't have an account):

We have identified this issue as a duplicate of an existing one and we will be closing the issue.
I've reached out to developers and they said that it's the expected behavior as "SetTime changes only the current Time of the playable.
https://docs.unity3d.com/ScriptReference/Playables.PlayableExtensions.SetTime.html
To make it work you need to call SetTime twice in a row to also change the previous Time."
You can track original case's status here:
https://fogbugz.unity3d.com/f/cases/994081/

Any news on this?
I'm looking to have root motion applied when replaying an AnimationClipPlayable and it does NOT apply any root motion unless I call SetTime(0.0) twice on that clip playable.
If I call it once it will just reset the entire gameobject position back to the animation initial start position.
The animation has root motion, the Animator has "Apply Root Motion" enabled.

[quote=“Kybernetik”, post:6, topic: 864184]
I reported it a few years ago (case 1005591) and got this response (the link to the original case asks me to log into FogBugz but I don’t have an account):

We have identified this issue as a duplicate of an existing one and we will be closing the issue.
I’ve reached out to developers and they said that it’s the expected behavior as "SetTime changes only the current Time of the playable.
https://docs.unity3d.com/ScriptReference/Playables.PlayableExtensions.SetTime.html
To make it work you need to call SetTime twice in a row to also change the previous Time."
You can track original case’s status here:
https://fogbugz.unity3d.com/f/cases/994081/
[/quote]

Yes, but it still doesn’t make any sense why calling “SetTime(0)” twice applies root motion from where the animation last finished and calling it once it resets the gameobject back to its original animation position even though the “Animator” component has “Apply Root Motion” enabled.