Animator Wait For State Bug?


New member
I was trying to block a script by waiting for an animator state change with "Animator/WaitForState" but it never matched. Looks like Unity may have changed the API on you. I suspect the following change is required, since according to the 2018.3 documentation, state.shortNameHash returns the same value as StringToHash() whereas .fullPathHash includes the layer information:

public override TaskStatus OnUpdate()
var state = animator.GetCurrentAnimatorStateInfo(layer.Value);
// OLD CODE: if (state.fullPathHash == stateHash) {
if (state.shortNameHash.CompareTo(stateHash) == 0) {
return TaskStatus.Success;