Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Animation Events and Behaviours Not Being Called

Discussion in 'Animation' started by jbassking, Oct 5, 2023.

  1. jbassking

    jbassking

    Joined:
    Feb 27, 2014
    Posts:
    118
    I'm using Animation to move a panel so it slides up from the bottom. Just like an action sheet on iOS.

    I have an Animator on my panel. There is the default state that connects to the open state. The open state connects to the close state. The transition between open and close sets an "open" condition to false. On the open state I added a behavior which overrides the different OnStateXXX methods. None of the methods ever get called.

    I also adding events to the timeline and assigned a method to it but the events never fire.

    I'm wondering if there is a simple settings I'm somehow missing.

    UPDATE
    I added a sample project to this issue.

    Code (CSharp):
    1.     public class PayWithPanelState : StateMachineBehaviour
    2.     {
    3.         public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    4.         {
    5.             Debug.Log("OnStateExit");
    6.             base.OnStateExit(animator, stateInfo, layerIndex);
    7.  
    8.  
    9.         }
    10.  
    11.         public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    12.         {
    13.             Debug.Log("OnStateExit");
    14.             base.OnStateExit(animator, stateInfo, layerIndex, controller);
    15.         }
    16.  
    17.         public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    18.         {
    19.             Debug.Log("OnStateEnter");
    20.             base.OnStateEnter(animator, stateInfo, layerIndex);
    21.         }
    22.  
    23.         public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    24.         {
    25.             Debug.Log("OnStateEnter");
    26.             base.OnStateEnter(animator, stateInfo, layerIndex, controller);
    27.         }
    28.  
    29.         public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    30.         {
    31.             Debug.Log("OnStateUpdate");
    32.             base.OnStateUpdate(animator, stateInfo, layerIndex);
    33.         }
    34.  
    35.         public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    36.         {
    37.             Debug.Log("OnStateUpdate");
    38.             base.OnStateUpdate(animator, stateInfo, layerIndex, controller);
    39.         }
    40.     }



    timeline.png

    p2.png
     

    Attached Files:

    Last edited: Oct 5, 2023
  2. jbassking

    jbassking

    Joined:
    Feb 27, 2014
    Posts:
    118
    False alarm. I didn't have the logging visible in the console so I wasn't seeing the logs. :oops: