Hi folks.
I’m using Mecanim to handle my combo system.
The idea is pretty simple, every state that belongs to the same combo is labelled with the same tag.
All attack states are in the same submachine.
To know if the combo is still going or has been interrupted I want to check the next state tag, so I wrote this on a StateMachineBehaviour.
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
Debug.Log(animator.GetNextAnimatorStateInfo(0).tagHash);
Debug.Log(stateInfo.tagHash);
if (animator.GetNextAnimatorStateInfo(0).tagHash!=stateInfo.tagHash)
{
Debug.Log("Esco dalla combo");
CharacterInput.attacking = false;
}
}
As expected, the second Debug.Log writes the same hash for every combo state I’m currently into, but the first one always writes 0.
Am I doing something stupid up there?
Since the documentation states that GetNextAnimatorStateInfo is only available on transitions and OnStateExit is called on the last frame of a transition from the behaviour carrier, this should be perfectly legit!
Thank you in advance for your time
@Noob4Sale You know I can't believe it was that... It's working as intended now. Even after you pointed it out it still took me a minute to see the missing "i". I'm putting it down to stupidity induced by writing too many coroutines in one day :-P Even though it was such a simple mistake I believe I offered a Steam Key to the guy that helped! If you want it when it becomes available drop an email to orc-horn-productions@outlook.com FAO Ross. Cheers buddy!
– Orc_Horn_Productions