I’ve been trying to setup an animation controller where a state can move to different targets based on some property. Determining this value only happens at the end of the first animation (e.g. checking for a button press within a given time):
State A ---v=1---> State B | -----v=2---> State C
Note that the animations are 2D and made with matching start/end keyframes so no blending is used.
I’ve tried two approaches to this:
Have an empty ‘dummy’ state after the first with an OnStateEnter script calling the logic to set the property. This works every time but, even though the transitions out of the dummy state are all zero length, it still takes a frame so causes a glitch in the animation.
Have an animation event at the end of the first animation calling the logic to set the property. This avoids the glitch but even moving the event back a couple of frames, doesn’t seem to guarantee it is processed before the transition so it may be set too late and move onto the wrong state.
Is there anything anyone can recommend changing to fix one of these approaches (or give another option that could work)?