Closed bennettdc closed 4 years ago
Unfortunately, this is a Unity bug which I have no control over (Case 1230811). As noted in my bug report, you can work around it by opening the animation in a text editor and changing the event time to a really small value like 0.0001 instead of 0. This is one of the reasons I implemented Animancer Events.
Environment
Description
When replaying a clip that is already playing using e.g. Play(_clip) or Play(_clip,0,FromStart), the first frame's (Unity) Animation events do not fire.
Reproduction
Steps to reproduce the bug:
Examples/01 Basics/05 Simple Hybrid
[SerializeField] private int _numSwings;
2c. Add a new function for demonstration:public void CountSwings() { _numSwings++; }
Therefore an event at frame 0 does not fire if its animation clip is restarted. All other events work fine.
Further notes
I have tried messing around to circumvent this, to no avail. Adding code to micro-switch animations right before switching back doesn't help, nor does Stopping the animation first, nor does setting the time of the animation to 0. It only fires if switching from a different state.
SimpleHybrid.txt