I have several animations that should be called depending on a specific variable. This is what controls them:
if (moveVelocity == 0 && canMove && !isJumping && !isRolling && !isClimbing) {
playerAnim.SetInteger("currentState", 2);
}
if (moveVelocity != 0 && canMove && !isJumping && !isRolling && !isClimbing) {
playerAnim.SetInteger("currentState", 3);
}
if (isJumping) {
playerAnim.SetInteger("currentState", 4);
}
if (isRolling) {
playerAnim.SetInteger("currentState", 5);
}
if (isClimbing) {
playerAnim.SetInteger("currentState", 6);
}
It seems flawless except for one part. Whenever I begin climbing something, the animation state only changes to the climbing animation if I am standing still. If I run and jump towards it and press the climb button, it begins climbing, but the animation stays on the walking animation. Same thing happens if I roll and then begin climbing. My question is: Why is this happening? Shouldn’t the animation controller see that if the climbing boolean is true that the walking animation shouldn’t be playing? Can anyone tell me why when isClimbing is true, the walking animation still plays, even though it’s one of it’s conditions is !isClimbing? Let me know if you need anything else to solve the problem. Thanks!