- Home /
Animator is not playing a Playable
I am receiving a Warning in the log when I make a call to Animator:SetBool
Below is the call trace I am getting from it:
Animator is not playing a Playable
UnityEngine.Animator:SetBool(String, Boolean)
ItemPurchaseConfirmation:BeginPurchase(ButtonBuy, Action 1) (at Assets/ItemPurchaseConfirmation.cs:48)
ButtonBuy:OnButton() (at Assets/Code/Scripts/Store/ButtonBuy.cs:46)
UnityEngine.EventSystems.EventSystem:Update()
I have made sure that the proper Animator
object is being referenced in the script. The animator starts using a single-keyframe animation setting the position of a RectTransform
to be above the screen. This transitions to another single-keyframe animation with the transform near the middle of the screen when the SetBool
method is called. If I manually enable the boolean value in the Animator GUI, then the transition occurs as expected and the "animation" plays naturally, but not when this is done by a script.
The method call happens and the error above is thrown. The Animator
component on the object in question has all defaults except for the controller described above. (Avatar: none; Apply Root Motion: false; Update Mode: normal; Culling Mode: always)
The error "Animator is not playing a Playable" can has multiple causes. The animator component could be disabled or the gameobject / the gameobject in the hirachi could be not active.
Everything in the Hierarchy is enabled, and the Animator itself is always active as well.
Answer by meat5000 · Mar 29, 2016 at 12:22 PM
I think a single key does not count as a Playable Animation.
In the past I have had to use at least 2 keys in my animation. Sometimes in order to achieve this I simply duplicated the first frame and then unity behaved normally.
If you create a new Animation Clip in the Animation window you will notice it has a key at 0 and a key at 1s by default.
Answer by nicafornica · Mar 29, 2016 at 12:22 PM
this has something to do with prefabs and instances of such. I have the same problem but I do not know how to fix it.
Actually I tried something i saw someone do, but with another component ins$$anonymous$$d of an animator.
Basically you have to get the component from the instance. $$anonymous$$y issues was when I was entering a collision, so to fix that here is what I did on my code:
void OnTriggerEnter2D (Collider2D other)
{
if(other.tag == "Bubble")
{
Destroy(other.gameObject, clip.length - 0.1f);
anim = other.GetComponent<Animator>();
anim.SetTrigger("Enter");
}
}
Now, I do not know how efficient this is, since we get the component every time I enter the collision, but it is the only way i got it to work.
Your answer
Follow this Question
Related Questions
Conflicting Animator SetTrigger 0 Answers
Set boolean to false when animation changes? 1 Answer
pause Animation 0 Answers
Is it possible to always make animations play differently? 0 Answers