# .GetButton issue

**URL:** https://discussions.unity.com/t/getbutton-issue/423280
**Category:** Animation
**Tags:** Scripting
**Created:** [September 17, 2010, 8:05pm UTC](https://discussions.unity.com/t/getbutton-issue/423280 "2010-09-17T20:05:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anon\_76966402](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anon\_76966402](https://discussions.unity.com/u/anon_76966402)
#### Post date: [September 17, 2010, 8:05pm UTC](https://discussions.unity.com/t/getbutton-issue/423280/1 "2010-09-17T20:05:11Z")

</div>

Im having an issue with the the script:

if(Input.GetButton(“Run”))  
{  
animation.CrossFade(“run”);  
walkSpeed = 4;  
}

This is the error i get:

The animation state run could not be played because it couldn’t be found!  
Please attach an animation clip with the name ‘run’ or call this function only for existing animations.  
UnityEngine.Animation:CrossFade(String, Single, PlayMode)  
UnityEngine.Animation:CrossFade(String, Single, PlayMode)  
UnityEngine.Animation:CrossFade(String)  
makeMove:Update() (at Assets\makeMove.js:26)

Despite me being a novice in Java, I know its telling me a did not make a split animation for “run”, even though I’ve made one, I also named the input as “Run”.

Any help would be greatly appreciated!

-Max

![388734--13372--$sendtounityforum2_run_202.jpg](https://europe1.discourse-cdn.com/unity/original/3X/e/e/ee879e3b140bd327ab3273e11b0a956244a31d10.jpeg)  
 ![388734--13373--$sendtounityforum2_run2_186.jpg](https://europe1.discourse-cdn.com/unity/original/4X/0/0/d/00d958b09bd28f4677c16c86bdc2610c3bde464a.jpeg)

---

<div class="post-metadata">

### Author: ![anon\_43237147](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@anon\_43237147](https://discussions.unity.com/u/anon_43237147)
#### Post date: [September 17, 2010, 9:41pm UTC](https://discussions.unity.com/t/getbutton-issue/423280/2 "2010-09-17T21:41:09Z")

</div>

“Run” != “run”. You have it mis-spelled (capitalized) in your script.

---

<div class="post-metadata">

### Author: ![anon\_76966402](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anon\_76966402](https://discussions.unity.com/u/anon_76966402)
#### Post date: [September 18, 2010, 1:02am UTC](https://discussions.unity.com/t/getbutton-issue/423280/3 "2010-09-18T01:02:09Z")

</div>

Thanks Laurie,

Do i not have it specified that the \*.GetButton(“Run”) is the input name, and animation.CrossFade(“run”)is the split anim name?

…I guess I’m a little confused.

---

<div class="post-metadata">

### Author: ![Vicenti](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/vicenti/32/369474_2.png) [@Vicenti](https://discussions.unity.com/u/Vicenti)
#### Post date: [September 18, 2010, 3:44am UTC](https://discussions.unity.com/t/getbutton-issue/423280/4 "2010-09-18T03:44:24Z")

</div>

Does the Animation have a “run” animation?

I know it’s kinda goofy, but when I add an animation and reimport, I have to manually add the new animations to my objects.

---

<div class="post-metadata">

### Author: ![anon\_43237147](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@anon\_43237147](https://discussions.unity.com/u/anon_43237147)
#### Post date: [September 18, 2010, 7:30pm UTC](https://discussions.unity.com/t/getbutton-issue/423280/5 "2010-09-18T19:30:36Z")

</div>

> [@""](#):
>
> Thanks Laurie,
> 
> Do i not have it specified that the \*.GetButton(“Run”) is the input name, and animation.CrossFade(“run”)is the split anim name?
> 
> …I guess I’m a little confused.

Oops, sorry, you’re right. Are you sure that (a) the game object the script is attached to is the one that has that animation; and (b) that the script is _not_ attached to any other game objects?

---

<div class="post-metadata">

### Author: ![anon\_76966402](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@anon\_76966402](https://discussions.unity.com/u/anon_76966402)
#### Post date: [September 20, 2010, 3:06pm UTC](https://discussions.unity.com/t/getbutton-issue/423280/6 "2010-09-20T15:06:34Z")

</div>

Laurie and Vicenti, I’m greatful for the help.

I’m still having the same problem. Laurie, i double checked what objects have the script running in my hierarchy and it seems the only thing that has it applied is the character. There is a 12 frame animation to which im calling as run in the split anim window. Vicenti, when you say you manually add the new animation to the objects, do you mean when you have seperate animation files? I’ve built all the animation in one file and split the animation by frame.

Thanks again guys,

Max
