Search Unity

"Animator is not playing an AnimatorController" UnityEngine.Animator:SetTrigger(String)

Discussion in 'Animation' started by BongoGaming, Apr 8, 2017.

  1. BongoGaming

    BongoGaming

    Joined:
    Apr 8, 2017
    Posts:
    2
    Trying the tutorial https://unity3d.com/learn/tutorials/topics/2d-game-creation/animating-bird?playlist=17093

    When I run the game and the script does a setTrigger I get this error in the console "Animator is not playing an AnimatorController"

    The games runs but I cannot understand how to make this error go away

    I am using 5.6.0f3 and the demo video is using 5.5 so perhaps the instructions don't match up or perhaps I've just done something wrong.

    Any clues where to look or other info I could provide to help someone help me?

    FYI there is a background animation too - and I've noticed that when this error occurs the bg animation stops.

    Thanks
     
    Lost2096 likes this.
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    747
    Just for completeness (and others googling the problem):
    This warning will be thrown, when the gameobject containing the animator is not active. To avoid the problem check for animator.gameObject.activeSelf.
    Source
     
  3. imrankhanswati

    imrankhanswati

    Joined:
    Jul 14, 2016
    Posts:
    5
  4. Camtas

    Camtas

    Joined:
    Jul 8, 2018
    Posts:
    1
    I'm just having the problem that GetCurrentAnimatorStateInfo isn't working it says GetCurrentAnimatorStateInfo(Int32) And also this appeared: SetFloat(String, Single)
     
    Last edited: Jul 9, 2018
  5. MSachs

    MSachs

    Joined:
    Nov 22, 2017
    Posts:
    108
    Am I right in thinking that this error actually isn't that bad for the game? I have the same thing because the GameObject containing the animator is repeatedly being activated and deactivated. But everything seems to run just fine when the the object is active and playing the animation.
     
  6. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    It a warning to let you know that you are trying to change something but the animator cannot carry out the operation because it disabled or it not playing any animation.

    You are basically doing an operation that does nothing.
    So the warning isn't that bad for a game but you are actually using cpu cycle that will give no result.
     
    Redrojo, radiantboy and MSachs like this.
  7. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,386
    This seems to happen any time you disable a game object with an animator on it. Even if no script is doing anything and no calls to setTrigger, it happens here until i re-enable the object. Which means I cant turn off an animator or it just constantly has this warning coming up. Any solution to that ?
     
  8. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
  9. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,386
    Sorry for the delay, though I cannot report the bug, the bug reporter has errors, it says "error occured whhile creating an archive error code file read failed", im not attaching files.

    my report would have been:

    1. What happened



    If I disable a gameobject with an Animator on it, and it is completely off with no script using it. I still get "Animator is not playing an AnimatorController" as a warning in my game (repeatedly not just once), this creates a lot of output in my console, when really there should be none, because the objects aren't even on anymore. The reason they turn on and off in my game is that when I leave a city theyre turned off, when I come back theyre turned back on.



    2. How we can reproduce it using the example you attached



    Turn off any gameobject using an animator at run time
     
    PrimalCoder likes this.
  10. Fick1995

    Fick1995

    Joined:
    Jul 26, 2019
    Posts:
    1
    Animator is not playing an AnimatorController. This error pops up whenever the setTrigger is called in a script. When this error happens the bird animation still works but the background animation stops moving.
     
  11. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,386
    yeh it seems to happen no matter if you call setTrigger or not.
     
  12. PrimalCoder

    PrimalCoder

    Joined:
    Aug 12, 2014
    Posts:
    9
    I'm still getting this warning two years later in 2021.3.21f1 when saving my scene.

    I have an object with a component derived from Button and an Animator component. If I change any properties of any component on the GameObject and then save the scene, I get a burst of "Animator is not playing an AnimatorController" warnings that originate in the following line of code in Editor.OnInspectorGui() :

    Code (CSharp):
    1.  
    2.     // Have to comment out the following test because it results in a flood of "Animator is not playing
    3.     // an AnimatorController" warnings for some bizarre reason when saving the project.
    4.     //
    5.     if( false == button.animator.parameters.Any( x => x.name == button.TransitionAnimations.NormalToSelected ) )
    6.  
    The GameObject is not disabled.
    The Animator component is not disabled.
    The Button component is not disabled.
    Animator.runtimeAnimatorController is not null.

    I am not attempting to play any animation or set or clear any triggers, I am simply attempting to query the parameters to see if a Trigger with a given name even exists.

    I have not been able to find a workaround, other than simply not attempting to retrieve the list of parameters, which is obviously not a feasible workaround.

    [EDITED TO ADD]
    In my particular case, adding a check for
    EditorApplication.isUpdating
    resolved the issue during save, although I have now noticed that I still get the warning when I hit the Undo button after making any change in the scene.
     
    Last edited: Nov 24, 2021
unityunity