Animator is not playing an AnimatorController

The error I get is …

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

I’m working on the beginner bird game tutorial.
I’m using Unity 5.6.0f3 and the tutorial is using 5.5

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.

Any clues where I can look for help to understand what I’m doing wrong?
What info can I support to help out?

PS:

are there completed versions of the tutorials available on git hub or somewhere where I could compare mine vs a bug free version?

Thanks in advance.

For me it was checking if the animator isActiveAndEnabled

if (animator != null && animator.isActiveAndEnabled)
{
    animator.Play(stateName, 0, percentage);
}

This warning also occurs, when you try to run methods on an Animator (SetFloat/Play/etc.) that is attached to a Prefab, instead of a instantiated GameObject.

For example:

You have a GameObject (name - “MyLists”) with List type Duck.

Duck is just a regular prefab with a script that has a method , let’s say… “ShowUp()” .

The list fullfills with Duck GameObjects by itself. Doesn’t matter how.

Your other GameObject (name - “Manager”) on a scene runs method “ShowUp()” on every Duck GameObject in the list. But because of some reason, you want to run method “ShowUp()” even if there are no object (no Ducks) on the list. Because this method makes some cool stuffs. So you assign the Duck Prefab to the Manager GameObject, so it can take a script from this Duck prefab, and run method “ShowUp()”.
If the method “ShowUp()” has something like “animator.SetFloat(…)”, it will cause an warning we’re talking about.

*It will not cause an error “animator not assigned”, because Duck prefab may have assigned “animator” in the Inspector.

Next part of this post is about a real “Duck” problem that I’ve had

You don’t need to read it if you’re not interested, you already know everything that you need about error/warning we’re talking about.

You can say… Well, that’s weird thing won’t ever happen, why should I run “ShowUp()” when there are no Ducks. But that’s not true. Look at this:

I make a multiplayer game with object pooling. Only the Master Client (or server) can add new objects to the pool. After that he send message to everyone that he has just created a new object in the pool, and everyone needs to that in theirs local pools too (to stay synchronized).
Of course, all this time the Master Client sends data about every object in the pool to other players, so they can be synchronized (like position, velocity, etc.). Every data he sends MUST be read by a client. If that won’t happen client may read “old” data as a new message, and assing values (like position, velocity) to a different object in the pool.
In case Master Client adds new object to the pool, he starts to send data about it to everyone. Sometimes client won’t catch up to make this new object before he gets informations about it. So he need to make something like “fake read”, just read informations but do not assign them to any gameobject (because he didn’t create the proper one). That is when I want to use Read method from a prefab, I just set a parameter fakeRead to True in method Read(bool fakeRead) and it does a fake read. If in my Read method I use animator.SetFloat((float) stream.ReceiveNext()) it will cause an warning we’re talking about, because an animator is a prefab’s animator.

Let’s say the Master Client has just created third object, and he now sends informations about objects.

for every object:
object.SendsInfo()
(it will runs 3x times)

Client didn’t create object3 yet, but he receives data:

for every object:
object.Update(stream.ReceiveNextData())
(it will runs 2x times)

in next loop Client will subscrive informations about object3 to object1 !!!

Of course I propably can walk around this problem in a different way, maybe like flushing streams, change the way master communicates with client, etc. But hey! that’s my solution for now and it works perfect! :slight_smile:

i solved it, use :

if(animator.gameObject.activeSelf){
       animator.Play("fire")
}

if gameObject is activeSelf = false , and you Play animator,unity will give a warnning ;

I had the same problem, on the SetBool line in the code below.

Confirming the Animator has a valid runtimeAnimatorController, before calling SetBool, resolved the issue, for me.

if (animator != null)// animator is of type "Animator"
{
    if(animator.runtimeAnimatorController!=null)// this check eliminiated the warning message
        animator.SetBool(stateAnim, true);
}

I just found it.
The script in question was attached to the bird object as desired however it was also attached to the ground and the ground wasn’t animated.
So I’m guessing the error about the missing controller was because the script tried to interact with the ground.
The error message could be improved by indicating which object name didn’t have an animator controller.

Thanks

I just got unity yesterday and I’m in the middle of an online video tutorial and I’m getting the same AnimatorController error type thing when I use the command GetCurrentAnimatorStateInfo And it doesn’t work anyway and really want to get on with the tutorial, it would probably be better if you knew where it all tied in so the video is:

Thanks for your time if you help:3 and also sorry if this isn’t the place to put it (As I said, I’m new)

I know I am two years late but I had a similar issue trying to animate a specific UI element. This element was a child of another UI element that was disabled. I was trying to set a trigger before I enabled the parent menu element if that makes sense. Hop This will help someone. Remember to check the order of your code. My trigger command was one line before my command to enable the parent object. ;(

Hey, I’m having a similar issue but my animator isn’t attached to anything aside for my player model.
I’m making a fighter game and I don’t know how to fix this error because mine doesn’t seem to apply to everything you guys have.

My issue goes like
Hit trigger button (H), animation plays, animation freezes
Hit trigger button (H) again, goes back to idol.

My character is supposed to go back to idol animation after the trigger is hit automatically. How do I fix this?
https://drive.google.com/open?id=1RMgUeHRRFghV4gTWZKfkFRfVJqIb8BFV

Here is my file, I can’t for the love of god, find the issue.

Posting this here for anyone that comes across a similar issue.

I have a Statemachine that has a knockback state.
The knockback state plays a knockback animation and checks for the animation to complete.
When its complete it goes back to Idle.
Problem was when going back to Idle state the animator doesn’t play any animation.

The way the knockback transition worked is something like.

stateMachine.anim.Play("Knockback");
var animTime = stateMachine.anim.GetCurrentAnimatorStateInfo(0).normalizedTime;
if (animtime %1 < .99f){
    stateMachine.changestate(idlestate);
}

and the Idle State Onstart looks like

void OnStart(){
    stateMachine.anim.Play("Idle");
    Debug.Log(" this log worked but the animation doesnt play")
}

I fixed it by changing the Knockback transition part to check if the current animation playing is the desired one, and if its not to play that one.

if (stateMachine.anim.GetCurrentAnimatorStateInfo(0).IsName("Knockback")){
    var animTime = stateMachine.anim.GetCurrentAnimatorStateInfo(0).normalizedTime;
     if (animtime %1 < .99f){
           stateMachine.ChangeState(stateMachine.idlestate);
     }
}
else{
    stateMachine.anim.Play("Knockback");
}

Hope this will help