hi all,
i have downloaded a model from asset store. this model has amimator component with controller component. Controller component has many clips and play them respectively when i activate animator. i would like to play only one of them in case of situation, run, walk, jump etc. but i have not accomplished to play one specific clip although it prints all clips. the code share below not worked:
Animator anim = hero.GetComponent<Animator>();
RuntimeAnimatorController ac = anim.runtimeAnimatorController;
for(int i = 0; i<ac.animationClips.Length; i++) //For all animations
{
AnimationClip clip = ac.animationClips *;*
-
print (clip.name);*
-
if(clip.name == "Walk") //If it has the same name as your clip*
-
{*
-
print ("play it...");*
-
anim.Play("Walk");*
-
}*
-
}*