I’m trying to do an animation in unity,
Changing it with script,
and when i Jump and then press the arrow key it is fine, but if i jump while holding the arrow key it switches between the jump and the walking,
here is my code:
if (dirX != 0 && GameManager.instance.grounded)
{
anim.SetBool(“walking”, false);
anim.SetBool(“jump”, false);
//Debug.Log(“grounded”);
}
else if (GameManager.instance.grounded && dirX == 0)
{
anim.SetBool(“walking”, true);
//Debug.Log(“Walking”);
}
else if (!GameManager.instance.grounded)
{
anim.SetBool(“jump”, true);
//Debug.Log(“Jumping”);
}
what is wrong here?