- Home /
 
 
               Question by 
               lasan0609 · Jan 14, 2018 at 05:15 AM · 
                animationanimatorscript.animator controller  
              
 
              [Solvedf]Animator is not playing an AnimatorController
Hello guys. I want to change the animation from a Button UI. When I do that I get an error "Animator is not playing an AnimatorController ". I have done the same thing manually, and also from the unity method. But same result.


public void CustomTrigger(string triggerName) {
     Animator anim = this.GetComponent<Animator>();
     if (anim.gameObject.activeSelf)
     {
         anim.SetTrigger(triggerName);
     }
 }
 
               
                 
                2018-01-14-10h38-00.png 
                (142.1 kB) 
               
 
                
                 
                2018-01-14-10h42-19.png 
                (143.8 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by lasan0609 · Jan 14, 2018 at 05:43 AM
Ok. Thanks guys. I found what the issue was. I had used the prefab instead of the instance.
Answer by Diukrone · Jan 14, 2018 at 05:25 AM
It´s because you need to assign the anim file on serialize field where you attached this script!
Thanks bro. I forgot and attached the prefab. I should have attacked the instance.
Your answer