# Animation.

**URL:** https://discussions.unity.com/t/animation/437232
**Category:** Animation
**Tags:** Scripting
**Created:** [February 20, 2011, 4:15pm UTC](https://discussions.unity.com/t/animation/437232 "2011-02-20T16:15:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anon\_31121495](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@anon\_31121495](https://discussions.unity.com/u/anon_31121495)
#### Post date: [February 20, 2011, 4:15pm UTC](https://discussions.unity.com/t/animation/437232/1 "2011-02-20T16:15:03Z")

</div>

Here is simple code

> [@](#):
>
> function Start ()  
> {  
> animation[“walk”].wrapMode = WrapMode.Loop;  
> animation[“idle”].wrapMode = WrapMode.Loop;  
> animation[“walk”].speed = 2;  
> animation.Stop();  
> }
> 
> function Update () {  
> if (Mathf.Abs(Input.GetAxis(“Vertical”)) \> 0.1)  
> animation.CrossFade(“walk”);  
> else  
> animation.CrossFade(“idle”, 0.2);  
> }

And when I stop moving, I havent idle crossfade, only walk animation freeze… How to fix?

---

<div class="post-metadata">

### Author: ![anon\_61332637](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anon\_61332637](https://discussions.unity.com/u/anon_61332637)
#### Post date: [February 20, 2011, 10:08pm UTC](https://discussions.unity.com/t/animation/437232/2 "2011-02-20T22:08:48Z")

</div>

I’m a bit new to scripting, but does it work if you remove the ‘, 0.2’ from your idle crossfade?

Also, does the object you are animating have both of those animations attached to it?

---

<div class="post-metadata">

### Author: ![anon\_31121495](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@anon\_31121495](https://discussions.unity.com/u/anon_31121495)
#### Post date: [February 21, 2011, 6:36am UTC](https://discussions.unity.com/t/animation/437232/3 "2011-02-21T06:36:54Z")

</div>

1- No  
2-Yes

Any1 else?
