I have been working on this all day yesterday. Attempting a few different methods. But I can't seem to figure it out. I am new with Unity but until this point everything was going smoothly. I am trying to get my character to switch between the 'walking' and 'idle' animations i've made.
if(Input.GetKey ("left")){
transform.position.x = transform.position.x - 0.1;
animator.Play("walking");
}
One solution would be to make it play the idol animation when none of the movement keys are pressed.
if(Input.GetKey ("left")){
transform.position.x = transform.position.x - 0.1;
animation.Play("walking");
}
if(!Input.GetKey ("left")){
animation.Play("idle");
}
Also, animator should instead be animation.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments