Hi, im new here, im asking how to start my player animations when i pressing a walk button, i have a idle animation for my player, if player press “w” the walking animation is on and idle animation is off… and if player not pressing “w” the idle animation is on and walking animation is off… this animation is for FPS… (the idle animation is breathing) can anyone help me?
Hi, in your animation window create a new bool parameter called for example “IsWalking”. Make a transition between your Idle and your Walking animation and set the condition IsWalking == true. Then in your script write something like:
public Animator Anim;
void Start()
{
Anim = gameObject.GetComponent<Animator>();
}
void Update()
{
if (Input.GetKey(“w”))
{
Anim.SetBool(“IsWalking”, true);
}
else
{
Anim.SetBool(“IsWalking”, false);
}
}
For more information about animations look: