find animation ?

Hi …

How can I know if the player attached to him a specific animation ?

for example : ( just for explain my question )

if ( animation.find("Jump") ) **---> how can I do that ?** 
    animation.Play("Jump");

thanks…

You can use the brackets operator:

if(animation["Jump"])
    animation.Play("Jump");

if (this.transform.Find(“nameOfModel”))
{
this.transform.Find(“nameOfModel”).animation.Play(“Jump”);
}

Try and see if these few lines of codes can help you achieve what you want.

Why do you not just create a variable for that animation, and then check if that variable != null:

var jumpAnim : AnimationClip;

if(jumpAnim){
    animation.Play(jumpAnim.name);
}

You can just look through the list using Linq:

   using System.Linq;

   ...

   if(animation.Cast<AnimationState>().Any(c=>c.name == "Jump"))
   {
        animation.Play("Jump");
   }