Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Animator is not playing a Playable"

Discussion in 'Editor & General Support' started by matbrummitt, Sep 25, 2015.

  1. matbrummitt

    matbrummitt

    Joined:
    Jan 12, 2010
    Posts:
    107
    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:

    Code (CSharp):
    1. _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
     

    Attached Files:

  2. matbrummitt

    matbrummitt

    Joined:
    Jan 12, 2010
    Posts:
    107
    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
     
  3. kimardamina

    kimardamina

    Joined:
    Feb 13, 2014
    Posts:
    11
    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?
     
  4. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
    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.
     
  5. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    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.
     
    evoros, blackaria, orihq and 3 others like this.
  6. Barry100

    Barry100

    Joined:
    Nov 12, 2014
    Posts:
    200
    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:DeserializeComponent(Component, PhotonStream, PhotonMessageInfo) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:355)
    PhotonView:DeserializeView(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:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)
     
  7. matbrummitt

    matbrummitt

    Joined:
    Jan 12, 2010
    Posts:
    107
    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
     
    Westland likes this.
  8. Treyzania

    Treyzania

    Joined:
    Jul 21, 2014
    Posts:
    1
    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.

    Code (CSharp):
    1. this.Anim.SetBool("IsActive", true); // this.Anim == this.GetComponent<Animator>()
    Code (csharp):
    1. Animator is not playing a Playable
    I am using 5.2.3 if it is of any importance.
     
  9. Oncle-Ben

    Oncle-Ben

    Joined:
    Mar 20, 2013
    Posts:
    2
    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?
     
  10. Eluem

    Eluem

    Joined:
    Apr 13, 2013
    Posts:
    57
    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...
     
    Last edited: Dec 18, 2015
  11. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    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"
     
    Matt-Ostgard and fffMalzbier like this.
  12. orihq

    orihq

    Joined:
    May 25, 2016
    Posts:
    7
    Yup, that was it for me. Thanks
     
  13. cuervopunk

    cuervopunk

    Joined:
    Mar 4, 2017
    Posts:
    1
    Also, make sure to check that you have selected a controller in the inspector, animator component.
     
  14. KBossler

    KBossler

    Joined:
    Mar 8, 2017
    Posts:
    6
    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.
     
    Last edited: Mar 8, 2017