Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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?