"Animator is not playing a Playable"

Hi all,

I’ve had an infuriating bug today that I cannot seem to resolve, and googling “Animator is not playing a Playable” yields very few results. One other person asked about this and no answer was given, and they suggested it came about after upgrading to 5.2.

I’m quite simply trying to animate my UI, using the animation system. When the UI should show, I am simply attempting to set my animator’s “Show” bool parameter to true via script. When hiding, I set it to false. My animation states are set up to transition when this happens. When calling:

_animator.SetBool ("Show", false);

Nothing happens within my animator, and I get a warning in the console that says “Animator is not playing a Playable” (see attached image).

However, if I manually click the “Show” parameter’s checkbox on and off within the Animator panel, my transitions are happening exactly as I would expect. For some reason it’s just not working via script.

I’ve attempted to recreate the animator and animations from scratch and i’m still getting the problem. Oddly enough, other UIs are working just fine, triggered via script.

Any advice is greatly appreciated.

Thanks

Mat

Typically, after trying to resolve this for many hours and eventually posting here, I found the answer within 10 minutes.

The problem was that in my code I was referencing the Animator component on the prefab, not the instantiation of it.

Thanks

Mat

4 Likes

Hi, I have the same issue but I do not understand how you solved it. What do you mean? Can you please elaborate a little further?

for me, this problem happened because there was no animation in the animator Animator’s Controller parameter.

This is one of those brain fart moments where you should probably go for a jog and refresh yourself lol. You start to make tiny mistakes, but the moment you revisit things with a fresh mind, you’re read to go.

What most likely happens is that you dragged your prefab into your scene, and applied an animation to it, but didn’t apply the changes. Which left your prefab’s animator Controller component empty. Ensure you have a Controller in your animator component and the warning should go away, and your animations should play as crappily as they were made.

Just for reference, the error Animator is not playing a Playable can also occur when the gameobject the the animator is on is not active when setting a parameter. When the gameobject is active , its working fine again.

6 Likes

i too am having this issue… I cant get to the bottom of it! It happens when I have a multiplayer character on the game. I get other warnings after it. See below ! I really need help with this one. btw it could be coincidence but I upgraded to 5.2.2f1 the other day and i never had these issues before this BUT I have backups of my project. One from 4th september and when I run it it seems to work fine…

Animator is not playing a Playable
UnityEngine.Animator:SetFloat(String, Single)
NetworkCharacter:OnPhotonSerializeView(PhotonStream, PhotonMessageInfo) (at Assets/NetworkCharacter.cs:63)
System.Reflection.MethodBase:Invoke(Object, Object[ ])
PhotonView:ExecuteComponentOnSerialize(Component, PhotonStream, PhotonMessageInfo) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:524)
PhotonView:smile:eserializeComponent(Component, PhotonStream, PhotonMessageInfo) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:355)
PhotonView:smile:eserializeView(PhotonStream, PhotonMessageInfo) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:340)
NetworkingPeer:OnSerializeRead(Hashtable, PhotonPlayer, Int32, Int16) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3597)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1955)
ExitGames.Client.Photon.PeerBase:smile:eserializeMessageAndCallback(Byte[ ])
ExitGames.Client.Photon.EnetPeer:smile:ispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:smile:ispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)

Hi all,

I’m sorry for not having responded sooner, I didn’t know there had been more replies until I received a PM.

In my case, my script was referencing the Prefab object’s animator component. By this I mean that my script starts off by getting a reference to the prefab object so that it can instantiate it in my game. Elsewhere in code, I was trying to get the animator component, but I accidentally got this from the prefab object. What I needed to do was first instantiate the prefab and get the animator component from the new, instance of the prefab (so not from the prefab object).

I hope that’s a little clearer?

Sorry for the lack of code example, i’m a bit tied up at work at the moment.

Thanks

Mat

1 Like

Hi. I’m having the same error, but it appears to be for a different reason. I am using the code below to initiate a transition to the animation, but that transition never occurs and the error, exactly as you had in your original post, appears in the console. In the default state I have tried leaving out an animation as well as using an animation that does nothing. In the state I am trying to transition to I have an animation that moves the UI element in question down towards the center of the screen.

this.Anim.SetBool("IsActive", true); // this.Anim == this.GetComponent<Animator>()
Animator is not playing a Playable

I am using 5.2.3 if it is of any importance.

Treyzania, to quote fffMalzbier above: “the error […] can also occur when the gameobject the animator is on is not active when setting a parameter”. Could it be what is happening in your case?

I’ve suddenly started getting 4 copies of is warning every time I select one of my game objects in the hierarchy while it’s not active. I wasn’t having this issue before. The only change I made between my last iteration (which doesn’t have the error) and this iteration, is that I created a new animator for a different object, created an animation to it, and then copied a curve from a legacy animation that was originally attached directly to that object.

I don’t see how that could affect this… but I’m not sure… as I said, that’s the only thing I can remember changing.

EDIT (Additional information):
I just set the object to active, saved the scene and restarted unity. After doing this, even if I set active to false on the object, the warning doesn’t show anymore. However, after saving the scene with it set to inactive and restarting unity again, the warning reappears.

Again, I never had this issue before hmmmmm

Any advice?

EDIT (fixed the issue):
I ended up taking a copy of my last back up and replacing the entire Assets folder (which contains literally everything I’ve directly done to the project, everything outside is auto generated unity stuff). This fixed the issue. I guess something went haywire with some unity autogenerated data when I replaced that legacy animation with a recent one. Not sure exactly what went wrong though…

We confirmed this to be (in our case) calling .GetInteger() on an Animator whose root GameObject was disabled.

It is a handy malfunction to be warned about, however, it would be nice of Unity’s warning was more along the lines of:

“Warning: Animator: calling .GetInteger() when underlying .gameObject is disabled”

2 Likes

Yup, that was it for me. Thanks

Also, make sure to check that you have selected a controller in the inspector, animator component.

I am having this issue on Unity 5.5.1f1 I have tried all the suggestions listed here but nothing seems to work. The set up is like this:

  • Animation plays of a gift box dropping into view,
  • Idle animation loops of the gift box shaking back and forth till the user clicks on it (through invisible UI button),
  • On button press Animator.SetTrigger (“open”) is called (Debug.log statement confirms this occurs),
  • now I get the error Animator is not playing a playable. Instead of it playing the animation of the box opening.

If I trigger the “open” parameter through the Animator window it works fine. I’m not instantiating the game object and all the objects are active when the game starts. All the animations play fine if I just set the transitions to use exit time only as well. I’m really lost on what is wrong.

Solution Found

I decided to delete the existing Animator and Script components affecting the gift box as well as deleting the Animator Controller and Script files. I remade the Animator Controller using a different parameter name instead of “open”. This seemed to work, don’t know why.

Side note: I also discovered that the button script attached to the invisible button can set the animator trigger directly without having to go through a script.