Hi,
I have a piece of codes that seems broken. I try to geht the current state of my Animation and according to this I wan to change something.
public var currentBaseState : AnimatorStateInfo;
public var walkForwardState : int = Animator.StringToHash("Base Layer.WalkForward");
public var idleState : int = Animator.StringToHash("Base Layer.Idle");
.
.
.
currentBaseState = anim.GetCurrentAnimatorStateInfo(0);
print("currentBaseState: " + currentBaseState.nameHash);
print("idleState: " + idleState);
print("walkForwardState: " + walkForwardState);
switch (currentBaseState.nameHash) {
As you can see it should get the correct number and according to the number it should do different things in the code. The Problem is that the “GetCurrentAnimatorStateInfo(0)” is acting weird. This is the output I get from the prints:
currentBaseState: -1077224882
idleState: 270025622
walkForwardState: 575836345
I only have 2 States, idle or walking it should never be this strange negative number. Do you have any ideas? I tried it with different layer names etc.