Search Unity

[HELP] Can´t return to "idle" state

Discussion in 'Animation' started by pedrocandelaria, Oct 30, 2013.

  1. pedrocandelaria

    pedrocandelaria

    Joined:
    Oct 30, 2013
    Posts:
    1
    Code (csharp):
    1. //animation is initiated here
    2. void Start ()
    3.     {
    4.         dinos_j1[n_dino_j1].animation["walk"].layer = 1;
    5.         dinos_j1[n_dino_j1].animation["run"].layer = 2;
    6.         dinos_j1[n_dino_j1].animation["Attack_1"].layer = 3;
    7.         dinos_j1[n_dino_j1].animation["Attack_1"].wrapMode =WrapMode.Once;
    8.         dinos_j1[n_dino_j1].animation["Attack_2"].layer = 3;
    9.         dinos_j1[n_dino_j1].animation["Attack_2"].wrapMode =WrapMode.Once;
    10.         dinos_j1[n_dino_j1].animation["Attack_3"].layer = 3;
    11.         dinos_j1[n_dino_j1].animation["Attack_3"].wrapMode =WrapMode.Once;
    12.         dinos_j1[n_dino_j1].animation["Damage"].layer = 4;
    13.     }
    14.  
    15. //this is the loop sequence for the animations
    16. IEnumerator recuperar_turno (WWW w)
    17.     {      
    18.         //idle
    19.         dinos_j2[n_dino_j2].animation.CrossFade("idle");
    20.         //andar
    21.         dinos_j2[n_dino_j2].animation.CrossFade("walk");
    22.         //correr
    23.         dinos_j2[n_dino_j2].animation.CrossFade("run");
    24.         //ataque
    25.         dinos_j2[n_dino_j2].animation.CrossFade("Attack_1");
    26.         //idle j1 +  anim dano j1
    27.         dinos_j1[n_dino_j1].animation.CrossFade("Damage");
    28.         //idle
    29.         dinos_j2[n_dino_j2].animation.CrossFade("idle");
    30.     }
    31.  
    I have the animations playing in the right place and when i want them too, my problem now is returning to the idle state(idle animation) it just keeps looping between the animation but never returns to idle. I have tried Stop animation and Pause animation, but the idle cycle does not run in either case. The wrapMode for the idle animation is Loop all the other animations are defined in the beginning as Once.

    Any help or suggestions would be greatly appreciated.
    Thanks
     
unityunity