Search Unity

Entry state always uses default transition and ignores other conditional transitions (Bug?)

Discussion in 'Animation' started by achimmihca, Mar 27, 2016.

  1. achimmihca

    achimmihca

    Joined:
    Feb 13, 2016
    Posts:
    59
    Hi,

    for a test I created an empty GameObject and Animator. The Animator has two states, Open and Closed. Further it has a property Open.
    Now, if the Open property is true the Entry state should transition to the Open state. If the Open property is false the Entry state should transition to the Closed state.

    Problem is that the Entry state always transitions to the default state---even if other transitions have triggers that evaluate to true. So the transition to the Closed state is taken although the Open property is true.

    Is this a bug or is the default transition of the Entry state the first that is tested and thus is always taken? This would make other transitions on the Entry node useless.
     

    Attached Files:

  2. pratikhr-hirpara

    pratikhr-hirpara

    Joined:
    Jan 9, 2014
    Posts:
    2
    Hey I am also facing the same problem and I got the solution but solution is like hack. I made one empty state that have default transition from entry state and than i have triggered two more conditional transition from empty state. Its working for me. IT seems hack so I am recommending to find out proper solution.
     
  3. pratikhr-hirpara

    pratikhr-hirpara

    Joined:
    Jan 9, 2014
    Posts:
    2
    Here is my solution. Here in "new state" there is no animation clip. Its behaving like empty conditional node.
     

    Attached Files:

  4. Homer-Johnston

    Homer-Johnston

    Joined:
    Nov 26, 2012
    Posts:
    46
    Just want to bump that I'm having this problem too. If you transition into a sub-state-machine from another running state, the sub-state-machine will properly use the Default Transition only after evaluating all other transitions. If the layer reaches an Exit state, the layer Entry node does not evaluate any of its transitions.

    Unity needs to either fix this so the Layer Entry node evaluates other transition conditions first, or prevent users from adding transition nodes from the Layer Entry node.

    I'm a bit out of date on 5.3.2f1 but this bug has been around for at least 1.5 yrs... http://forum.unity3d.com/threads/su...ecedence-over-the-other-possibilities.294354/

    Is there a bug report for this anywhere or can anyone confirm that it is fixed in the newest Unity version? I would hope this gets fixed because this makes state machines *way* more difficult to build. Instead of the nice example from the documentation (see below) you have to create unique transitions from every single state to every other state to get the right behaviour.

    Using the "empty node" hack does not work because the gameobject will animate that null-animation for one frame which looks terrible, unless it is an Additive layer maybe.



    http://docs.unity3d.com/Manual/StateMachineTransitions.html
     
    Damjan-Mozetic and dreasgrech like this.
  5. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    520
    We don't have any outstanding bugs filed about this, which either means no-one filed a bug, or this has been fixed.

    If this is still happening in 5.3.5 (and later) or 5.4.x please file a bug
     
  6. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    218
    Has anyone tried this on 5.3.5+ as the UT rep suggests? I've had this issue forever (am currently on 5.3.3 where it still exists). I don't feel like upgrading right now to find out if it works in 5.3.6 as it is not a critical issue.
     
  7. Maxpeinas

    Maxpeinas

    Joined:
    Feb 19, 2014
    Posts:
    16
    I always add idle animation on entering state machine and then conditions for transition, works fine for me.
     
  8. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    205
    Still the same broken behavior on Unity 5.5.3p1.
     
  9. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    218
    I solved my particular problem by transitioning nodes to themselves to prevent the default transition from ever being evaluated.
     
    Patrick-Cho likes this.
  10. codegasm

    codegasm

    Joined:
    May 3, 2015
    Posts:
    34
    Coming directly from the entry state into a sub-state machine doesn't call the OnStateMachineEnter method, only when the transition comes from another state in the top level machine. That's why adding an empty state fixes the problem. The downside of that as mentioned is the time spent in that empty state.

    I found another workaround for the specific situation when you have one sub-state machine with a StateMachineBehaviour attached that controls which clip to play on entry in the sub-state:

    1: Build the sub-state machine with entry conditions and let each state transition to exit when done.
    2: Make the sub-state machine the default state on the top level machine.
    3: Instead of transitioning from the sub-state machine to exit on the top level you transition back to itself.

    Step 3 is the key here, I wasn't aware that one could even do that. But the result is that from the second time around the transition to the sub-state machine is technically from another state (itself) and as such it calls the OnStateMachineEnter method on the StateMachineBehaviour.

    One downside I see is that it will always start with a specific state but in my case that isn't a big issue. Another is that I'm guessing that the OnStateMachineExit is never called.
     
    LorenzoValente likes this.
  11. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    364
    Still happening in unity 5.6.4f1

    This picture won't work, as far as I know



    But if you go Entry > default > multiple transitions > exit and turn off "has exit time" and change transition duration to 0, the transition goes to the correct state instantly.
     
  12. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    Same problem here and we are in......... 2018 o_O



    Any solution?
     
    Last edited: Mar 20, 2018
    Khena_B and NestorAlgieri like this.
  13. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    520
    The orange State in your state machine is the default state for your layer.
    It will always be the default state getting played when you start your state machine, no matter what.
    If you want to force another state to play, you can call
    Code (CSharp):
    1. animator.Play(<YourState>);
    2. animator.Update(0); //force transition
    before the animator is evaluated. You can do it in Start, or you can do it in Update, or you can do it in FixedUpdate if your animator is in Animate Physics mode.

    You can even technically call this in a StateMachineBehaviour.
     
  14. Onsterion

    Onsterion

    Joined:
    Feb 21, 2014
    Posts:
    215
    I don't want to force nothing, i want to get the a correctly process of parameters in the "Entry" state.

    If enter from State (X or Any State) to "Entry" the transition with parameters is procesed but if the "Entry" is entered by "Exit" the transitions with parameters are voided.
     
    sand_lantern and skwsk8 like this.
  15. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    56
    I'm running into this exact same issue in Unity 2018.1.5 after doing some state machine refactoring. Unity, what is going on here? Why allow other transitions from the Entry condition other than the default if they don't work? This is horribly flawed - I'm trying to set up an idle state with different sub-states (normal, in-combat, etc.), and it's proving to be very painful.
     
  16. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    44
    Thanks for pointing this out.
    That bit of information helped ME to come up with a nice workaround for my problem.
    (Play random anims from the "Any State" without having to sacrifice blending => Just do the random switch with several contitional transitions from the "Entry" state of a sub-state-machine using randomly generated indices as conditions which are generated in the state machine behaviour on the sub-state-machine root node)
     
  17. Liam-Lam

    Liam-Lam

    Joined:
    Jan 31, 2013
    Posts:
    1
    2018 and this problem still exist. I found a really simple solution for this. Just DO NOT make your sub-state machine be default one. Create an empty state and set it as default. Thats all.
     
  18. mbbmbbmm

    mbbmbbmm

    Joined:
    Dec 28, 2013
    Posts:
    59
    Wow, it's pretty crazy... I now have an idle state in my base layer that immediately transitions to my idle sub-state machine. Now everything seems to work, entry conditions are evaluated properly etc. Before nothing was working at all. Unfortunate that this not documented, this thread was not easy to find...
     
  19. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    298
    This works to make it not get into an error-nous state or even infinite loop, but it make my animation transitions aweful. Anytime a animation that comes from ANYSTATE finishes, it will go back to run that default animation before the actual animation it should run.. that's real bad and ugly. I Can't believe this is still a bug after years!!!
     
    Damjan-Mozetic likes this.
  20. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    298
  21. Damjan-Mozetic

    Damjan-Mozetic

    Joined:
    Aug 15, 2013
    Posts:
    41
    I also have a big issue with this implementation, since I need the default state not to execute, but instead have the state chosen from a parameter. An empty first state also doesn't cut it, since it makes the animation glitch for one frame. I have asked some of my followers on twitter to vote on the issue, so hopefully it gets noticed soon and solved.
     
  22. evand

    evand

    Joined:
    May 22, 2013
    Posts:
    14
    How is this still a thing? I have to constantly add blank states to fix the animator or just do a TON of manual connections. This is a VERY common problem if you have multiple sub states and try to exit that state.

    If I have a "walking" substate for a 2D sprite and want to be able to transition to a "WalkingBare" or "WalkingShield", I need to be able to transition from Idle -> Walking and then be able to determine if the shield is equipped, then from WalkingBare or WalkingShield need to check if I'm walking and if a shield is equipped to see where I go in the Idle state.

    End result?

    An Entry node with 4 or 5 transitions... all of them ignored for whatever I set as default. This is bonkers -- why would it not just evaluate the transitions each time?
     
  23. Khena_B

    Khena_B

    Joined:
    Aug 21, 2014
    Posts:
    273
    I was a bit confused by this as well and mostly by the image from the documentation, but they're using a Sub-State machine and not the base layer's Entry node, the base layer's entry node absolutely needs a single default state to start with and will ignore other transitions, the problem is relying on the Exit node to return to the Idle state like I did, so instead of transitioning from "Walk" to "Exit" then base layer's "Entry" to "Idle" I transition from "Walk" to the "Idle" Sub-State machine, and let the Sub-State machine pick the correct transition like pictured below, and it works.

    With that said, I don't understand why the base layer's Entry node can't have multiple transitions, or can't default to a Sub-State machine instead of a particular state within that Sub-State machine, it really complicates things.

     
    michaelgatesdev and skwsk8 like this.
  24. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    364
    I think you need to assign 2 transitions to Idle normal.
    1 is the default transition and the second is the transition with a parameter.
    That seems to make it work.
     
  25. Zack_Wang

    Zack_Wang

    Joined:
    Mar 7, 2019
    Posts:
    1
    I tested and found it not working.
     
  26. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    1,827
    I don't use Animator Controllers because I think its a stupid system so I could be completely wrong, but couldn't you just have an empty state as the default and set all the optional transitions to immediately exit that state to whichever one you want?
     
  27. diesoftgames

    diesoftgames

    Joined:
    Nov 27, 2018
    Posts:
    87
    I'm not sure if this has been fixed yet or what, but it's KIND of working for me right now in 2019.1.4. I've been doing the EmptyState as default transition from Entry for a while, but the problem with that is that it spends a frame in that Empty state, which means that animation transitions actually take a frame longer. I hadn't noticed it until now, but since I was trying to avoid that I made a conditional transition from Entry to the animation state I want to get to more quickly (while still leaving the Empty state in place) and that actually gets me directly to my animation state without going through the empty state. I may have to duplicate transitions both from Entry and the Empty state, but if I can get this all working more smoothly I'll check back in.

    UPDATE: So I did need to keep my Empty state as the default transition from Entry, and it can't go straight to Exit or we'll just get stuck, BUT if I just make a transition from the Empty state to my Idle state, that seems to get the ball rolling so that then all my states can be transitioned to from Entry.

    So essentially my state machine looks like:
    [Entry] -- default --> [Empty] ----> [Idle] -- conditional not idling --> [Exit] --> [Entry] -- conditionals --> [Appropriate State] ... and so on.
     
    Last edited: Jul 10, 2019
    Ziplock9000 and mbbmbbmm like this.
  28. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    278
    I'm having this issue too with 2019.2.1f1. What a mess
     
  29. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    278
    What settings do you have on your Empty state and the transitions coming out of it? Mine pauses animations for a few frames and sometimes jerks?
    (Video shows this)


    Here's the outputs:


    Branch/Empty node:
     
  30. LorenzoValente

    LorenzoValente

    Joined:
    May 2, 2019
    Posts:
    37
    Two years later and this problem about
    OnStateMachineEnter
    is still unsolved... unbelievable.
    Unity team: FIX CURRENT FEATURES INSTEAD OF FOCUSING ON NEW ONES.
     
    andrew210 likes this.
  31. diesoftgames

    diesoftgames

    Joined:
    Nov 27, 2018
    Posts:
    87
    They look like this:

    Screen Shot 2019-08-29 at 2.48.56 PM.png

    Screen Shot 2019-08-29 at 2.49.12 PM.png

    But perhaps this is important: I'm ALSO going from Entry to all of my animation states, including those that are coming out of the Empty default state. So that Empty state only gets evaluated once and then it stays "in" the Entry -> Active State -> Exit loop without ever going to default.
     
  32. NextTime000

    NextTime000

    Joined:
    Sep 27, 2019
    Posts:
    1
    Hey I managed to get a conditional substate entry to work just fine:

    I got a behavior on the states inside the BasicCombo substate that increment/reset BasicStep, and a script on the Idle state that resets basicstep to 0. BasicCombo and Special Attack both got transitions to themeslves, but the main thing here is that TryBasic will send stuff into the BasicCombo substate, where it manages to successfully pick the correct basic attack to use based on the BasicStep parameter.
     
  33. DreamsVoyager

    DreamsVoyager

    Joined:
    Mar 5, 2017
    Posts:
    1
    2020 year.
    Unity 2019.2.17f1
    Still the same problem.
    You cant enter to StateMachine from Entry state.
    If you do this "StateMachineEnter" event wont be called and tansition conditions be ignorred.
     
  34. AntonPetrov

    AntonPetrov

    Joined:
    Dec 27, 2013
    Posts:
    27
    Looks like you should use Up state to leave the sub-state machine and start PROPERLY from the Entry node of the parent state machine.

    You should use Exit state if you want to leave and CONTINUE execution of the parent state machine. That assumes that your sub-state machine has an outgoing transition.
     
  35. gotcode_unity

    gotcode_unity

    Joined:
    Mar 22, 2020
    Posts:
    14
    Four years later. Still broken. I wasted an hour trying to figure out what I was doing wrong until I realized it was a bug when I found this thread.
     
    rafaelrbenavent and pango like this.
  36. pango

    pango

    Joined:
    Jan 14, 2013
    Posts:
    12
    I'm also facing this issue while trying to clean and organize my animator controller...
    Does anyone know if a bug has been filed? I can't find it in issue tracker
     
  37. tiagoandr

    tiagoandr

    Joined:
    Jun 30, 2019
    Posts:
    24
    oh yeah same here! I thought I was going crazy.
     
  38. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    71
    Man I love Unity, 5 years later and same thing happens. I'll check back in 5 years to see if they accidentally fixed it ...
     
    electric_jesus and Ekkara like this.
  39. choijaeyoung

    choijaeyoung

    Joined:
    Feb 8, 2020
    Posts:
    6
    So... there's no way to avoid the weird first frame of the default state by setting multiple entry animation state? Even setting anim time = 0 wouldn't resolve that issue. If that's the case, making spider-web like state machine technically works better than using Entry / Exit state given by the animator, since I can avoid that glitchy default state animation. That's quite a disappointment...
     
  40. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    364
    Dnno this still works for me. No empty state needed and the animation evaluate as intended.

    entry animation.png

    Dash front has the default transition and a transition with a condition like the ones beneath it

    entry 2.png
     
  41. Patrick-Cho

    Patrick-Cho

    Joined:
    Jun 6, 2017
    Posts:
    3
    Thank You.
    You Saved My Day
     
  42. TurboNic

    TurboNic

    Joined:
    Oct 7, 2015
    Posts:
    5
    I absolutely feel everyone's pain here. I've had this issue continually over the years and it drives me nuts! It would be nice for the Default Entry Transition to act as a fallback (which seems like is the intended use case), but there are times where it suddenly decides that it takes precedence over all other transitions. I have yet another solution that likely won't work in all cases, but wanted to share it here in case it can help anyone else:

    TL;DR - I delete all transitions from the entry node in my Sub State Machine and use a StateMachineBehaviour to manually cross fade to the appropriate animations based on an int parameter I've set up in the Animator Controller.

    So, my Sub State Machine looks like this with no transitions from the entry node to any of my states. Obviously, we can't do anything about the orange default entry transition, but it doesn't matter with this method.
    upload_2021-1-14_12-47-38.png

    I attach the StateChooserSMB script to the Sub State Machine and fill out the fields.
    upload_2021-1-14_12-26-39.png

    Int Param Name: The name of an integer parameter in the Animator Controller used to select which state we transition to next.

    State Prefix: For this system to work, I'm using Animator.CrossFade which requires the FULL path to the state in order to work. So, in this example, we'll need 'Base Layer.Talking.Talking Loops.' appended to the front of all our state names.

    State Names: The names of all the states in our Sub State Machine. There's no (quick) way to access these dynamically as far as I know, so you just have to type out all your state names again. If anyone has suggestions on how to populate this list dynamically, I would be very happy.

    And that's it for setup! Now let's talk scripts:

    StateChooserSMB.cs
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class StateChooserSMB : AdvancedSMB
    6. {
    7.     //The name of the integer parameter in the Animator Controller used to select which state we transition
    8.     //to next.
    9.     [SerializeField]
    10.     private string _intParamName;
    11.     //For this to work, we're using Animator.CrossFade which requires the FULL path to the state in order to work.
    12.     //So, in this example, we'll need 'Base Layer.Talking.Talking Loops.' appended to the front of all our state
    13.     //names.
    14.     [SerializeField]
    15.     private string _statePrefix;
    16.     //An array of all the state names in this sub state machine.
    17.     [SerializeField]
    18.     private string[] _stateNames;
    19.  
    20.     private int[] _stateHashes;
    21.  
    22.     //The last time OnStateEnter was called.
    23.     private float _lastStateEnterTime;
    24.     private float _timeoutTime;
    25.     private int _indexParamHash;
    26.  
    27.     //The duration of the transition between states. You can set this up as an inspector variable if you want.
    28.     private static readonly float TRANSITION_DURATION = 0.25f;
    29.  
    30.     private void Awake()
    31.     {
    32.         int stateCount = _stateNames.Length;
    33.         _stateHashes = new int[stateCount];
    34.  
    35.         for (int i = 0; i < stateCount; i++)
    36.         {
    37.             string statePath = _statePrefix + _stateNames[i];
    38.             _stateHashes[i] = Animator.StringToHash(statePath);
    39.         }
    40.     }
    41.  
    42.     public override void OnAdvancedStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    43.     {
    44.         //State enter was getting called multiple times. So when this function gets called we store
    45.         //off the current time.
    46.         float currentTime = Time.timeSinceLevelLoad;
    47.  
    48.         //If the current time is less than our timeout time, then we don't want to do anything at the moment.
    49.         //We only want this function to do anything once the timeout is up.
    50.         if (currentTime < _timeoutTime)
    51.             return;
    52.  
    53.         //If we make it down here, then we're outside of the timeout window. So we update some variables to
    54.         //start the next timeout period.
    55.         _lastStateEnterTime = Time.timeSinceLevelLoad;
    56.         _timeoutTime = _lastStateEnterTime + TRANSITION_DURATION;
    57.  
    58.         //Each of the states in our Sub State Machine is associated with an integer value. That integer value
    59.         //is getting set on our animator by an external C# script. So we access that value.
    60.         int intParamValue = animator.GetInteger(_indexParamHash);
    61.  
    62.         //And then we use that value to access the proper state in our state array.
    63.         animator.CrossFadeInFixedTime(_stateHashes[intParamValue], TRANSITION_DURATION);
    64.     }
    65. }
    That script inherits from AdvancedSMB.cs which is a modification of the extremely helpful script written by @JamesB found here: https://forum.unity.com/threads/extending-statemachinebehaviours.488314/

    Here's AdvancedSMB.cs
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Animations;
    5.  
    6. /// <summary>
    7. /// An advanced State Machine Behavior class that gives us better control over when certain events fire.
    8. /// Pulled from here basically wholesale https://forum.unity.com/threads/extending-statemachinebehaviours.488314/
    9. /// </summary>
    10. public class AdvancedSMB : SealedSMB
    11. {
    12.     private bool m_FirstFrameHappened;
    13.     private bool m_LastFrameHappened;
    14.  
    15.     public sealed override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    16.     {
    17.         m_FirstFrameHappened = false;
    18.  
    19.         OnAdvancedStateEnter(animator, stateInfo, layerIndex);
    20.         OnAdvancedStateEnter(animator, stateInfo, layerIndex, controller);
    21.     }
    22.  
    23.     public sealed override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    24.     {
    25.         if (!animator.gameObject.activeSelf)
    26.             return;
    27.  
    28.         if (animator.IsInTransition(layerIndex) && animator.GetNextAnimatorStateInfo(layerIndex).fullPathHash == stateInfo.fullPathHash)
    29.         {
    30.             OnAdvancedTransitionToStateUpdate(animator, stateInfo, layerIndex);
    31.             OnAdvancedTransitionToStateUpdate(animator, stateInfo, layerIndex, controller);
    32.         }
    33.  
    34.         if (!animator.IsInTransition(layerIndex) && m_FirstFrameHappened)
    35.         {
    36.             OnAdvancedStateNoTransitionUpdate(animator, stateInfo, layerIndex);
    37.             OnAdvancedStateNoTransitionUpdate(animator, stateInfo, layerIndex, controller);
    38.         }
    39.  
    40.         if (animator.IsInTransition(layerIndex) && !m_LastFrameHappened && m_FirstFrameHappened)
    41.         {
    42.             m_LastFrameHappened = true;
    43.  
    44.             OnAdvancedStatePreExit(animator, stateInfo, layerIndex);
    45.             OnAdvancedStatePreExit(animator, stateInfo, layerIndex, controller);
    46.         }
    47.  
    48.         if (!animator.IsInTransition(layerIndex) && !m_FirstFrameHappened)
    49.         {
    50.             m_FirstFrameHappened = true;
    51.  
    52.             OnAdvancedStatePostEnter(animator, stateInfo, layerIndex);
    53.             OnAdvancedStatePostEnter(animator, stateInfo, layerIndex, controller);
    54.         }
    55.  
    56.         if (animator.IsInTransition(layerIndex) && animator.GetCurrentAnimatorStateInfo(layerIndex).fullPathHash == stateInfo.fullPathHash)
    57.         {
    58.             OnAdvancedTransitionFromStateUpdate(animator, stateInfo, layerIndex);
    59.             OnAdvancedTransitionFromStateUpdate(animator, stateInfo, layerIndex, controller);
    60.         }
    61.     }
    62.  
    63.     public sealed override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
    64.     {
    65.         m_LastFrameHappened = false;
    66.  
    67.         OnAdvancedStateExit(animator, stateInfo, layerIndex);
    68.         OnAdvancedStateExit(animator, stateInfo, layerIndex, controller);
    69.     }
    70.  
    71.  
    72.     /// <summary>
    73.     /// Called before Updates when execution of the state first starts (on transition to the state).
    74.     /// </summary>
    75.     public virtual void OnAdvancedStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    76.  
    77.     /// <summary>
    78.     /// Called after OnAdvancedStateEnter every frame during transition to the state.
    79.     /// </summary>
    80.     public virtual void OnAdvancedTransitionToStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    81.  
    82.     /// <summary>
    83.     /// Called on the first frame after the transition to the state has finished.
    84.     /// </summary>
    85.     public virtual void OnAdvancedStatePostEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    86.  
    87.     /// <summary>
    88.     /// Called every frame after PostEnter when the state is not being transitioned to or from.
    89.     /// </summary>
    90.     public virtual void OnAdvancedStateNoTransitionUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    91.  
    92.     /// <summary>
    93.     /// Called on the first frame after the transition from the state has started.  Note that if the transition has a duration of less than a frame, this will not be called.
    94.     /// </summary>
    95.     public virtual void OnAdvancedStatePreExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    96.  
    97.     /// <summary>
    98.     /// Called after OnAdvancedStatePreExit every frame during transition to the state.
    99.     /// </summary>
    100.     public virtual void OnAdvancedTransitionFromStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    101.  
    102.     /// <summary>
    103.     /// Called after Updates when execution of the state first finshes (after transition from the state).
    104.     /// </summary>
    105.     public virtual void OnAdvancedStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    106.  
    107.     /// <summary>
    108.     /// Called before Updates when execution of the state first starts (on transition to the state).
    109.     /// </summary>
    110.     public virtual void OnAdvancedStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    111.  
    112.     /// <summary>
    113.     /// Called after OnAdvancedStateEnter every frame during transition to the state.
    114.     /// </summary>
    115.     public virtual void OnAdvancedTransitionToStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    116.  
    117.     /// <summary>
    118.     /// Called on the first frame after the transition to the state has finished.
    119.     /// </summary>
    120.     public virtual void OnAdvancedStatePostEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    121.  
    122.     /// <summary>
    123.     /// Called every frame when the state is not being transitioned to or from.
    124.     /// </summary>
    125.     public virtual void OnAdvancedStateNoTransitionUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    126.  
    127.     /// <summary>
    128.     /// Called on the first frame after the transition from the state has started.  Note that if the transition has a duration of less than a frame, this will not be called.
    129.     /// </summary>
    130.     public virtual void OnAdvancedStatePreExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    131.  
    132.     /// <summary>
    133.     /// Called after OnAdvancedStatePreExit every frame during transition to the state.
    134.     /// </summary>
    135.     public virtual void OnAdvancedTransitionFromStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    136.  
    137.     /// <summary>
    138.     /// Called after Updates when execution of the state first finshes (after transition from the state).
    139.     /// </summary>
    140.     public virtual void OnAdvancedStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller) { }
    141. }
    And its parent class SealedSMB.cs
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public abstract class SealedSMB : StateMachineBehaviour
    4. {
    5.     public sealed override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    6.  
    7.     public sealed override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    8.  
    9.     public sealed override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { }
    10. }
    Hope this is helpful to anyone! Good luck :)
     
unityunity