Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Animation Events, not updating animation until next frame.

Discussion in 'Animation' started by ViralArt, Mar 14, 2021.

  1. ViralArt

    ViralArt

    Joined:
    Apr 17, 2015
    Posts:
    10
    Example:
    BoxA has two animation states [Idle] and [MoveRight]
    Non of them loop and [Idle] has a trigger to start [MoveRight] "Very Basic"
    If you deactivate the GameObject, Unity leaves the object in the position where the [MoveRight] animation stopped and sits there practical in "no state".
    When you activate the GameObject again, It pops back to it's default "Enter" state [Idle] Which is the expected behaviour

    HOWEVER!!!
    If i call the activation of the GameObject with an "Animation Event" option 2 happens

    upload_2021-3-14_20-3-37.png



    As you can see, the code triggers on the correct frame but the animation is first updated on the next one.

    3th Test
    If i say the code should delay the action by one frame, but it's still initially triggered by an AnimationEvent
    we are back to normal:

    This however is not desirable and an UGLY HACK solution. I assume it has something to do with the order of the animation loop. Something Something.

    I have tried to force update the animation but no luck. Any Help?
     
    Last edited: Mar 14, 2021
unityunity