Player Animation HELP REQUIRED PLEASE

I have two different animations both linked to one GameObject (MainPlayer).
i made a script for it to play the running animation when “w” is held, when its let go play standing.
This is the code i have but it doesnt play the standing :frowning: If Anybody could help that would be awesome.

function Update () {
	if (Input.GetKeyDown ("w"))
		{
			//gameObject.animation.Stop(Stand);
			gameObject.animation.CrossFade("Walking");			
		}
	if (Input.GetKeyUp ("w"))
		{
			//gameObject.animation.Stop(Walk);
			gameObject.animation.CrossFade("Standing");
		}
}

Instead of using animation.CrossFade(), use animation.Play().

I would think you main problem is the input yu are using. GetKeyDown only returns true on the frame it goes down meaning only once and then back to 0. I think what you want is GetKey which returns true as long as you are pressing the key. If you release the else takes place and the animation is standing.

   function Update () {  
       if (Input.GetKey ("w"))  {  
           animation.CrossFade("Walking",0.2f);  
      }   
      else{
           animation.CrossFade("Standing",0.2f);  
      } 
    }

Not really sure though which of GetKey or GetButton is right…The documentation does not really explain any differences…