Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug OnStateEnter isn't called on the first update frame but the second

Discussion in 'Animation' started by jartison, May 15, 2021.

  1. jartison

    jartison

    Joined:
    Feb 24, 2021
    Posts:
    1
    Version: 2019.4.20f1

    Hello guys, sorry for my poor English, here is description:
    After a scene is loaded, the layer default state's OnStateEnter should be called on the first update frame as described in https://docs.unity.cn/2019.1/Documentation/ScriptReference/StateMachineBehaviour.OnStateEnter.html.

    But I found the layer default state's OnStateEnter wasn't called on that frame, but exactly called on the second frame.
    In Addtion, if the A was the layer default state, and there was a transition from A to B, and condition of the transition(no exit time and duration is 0) was true as default, in this case, the transition was indeed triggered on the first update frame, but A's OnStateExit and B's OnStateEnter were both not called!
    I guess the first update frame of a scene is ingored by SMB, I wonder if it is a bug?