playing one specific animation from animator controller

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");*
    
  •   	}*
    
  •   }*
    

It is possible that the walk animation is connected to other animations given some condition or maybe on exit time. So once it is played, it goes to play the next animation. If it is so, then in your case, you should disconnect the animation from others. I.E inside the animator window, your walk animation should not be connected to others.

Making your own Animator Controller is easier than you think. You know, you should read this article and then use commands like Animator.Play, Animator.SetTrigger, or Animator.SetBool

in fact i do not want to use state machine, animation controller.i want reach all clips and play by myself in case of situation via animation component. so i am trying to export clips from fbx but not allowed.