- Home /
Animator data exactly the same, but animator doesn't work
If I drag a model that contains an animation into my scene, a GameObject is created with an Animator component on it. When I test the game, the object animates just fine.
BUT if I delete the Animator component and create a new Animator component with the exact same values, animations no longer work. Anyone know what's going on here? And is there a way to get around this issue via scripting?
Answer by Max_Bol · Dec 15, 2016 at 03:27 AM
Just to make sure, you did apply the same Controller and Avatar to the "new" Animator Component, right? Also, is the new Animator Component on the same Top parent game object as the previous one with no change in its child game objects?
The following things will not allow you to animate your game object:
1) If you place the animator component on something else than the model top parent which has it initially.
2) If there's no Controller and/or Avatar set in the Animator component. (The Controller allow the engine to "talk" to the animation system while the Avatar link the animation system to the mesh' vertices by their individual vertices IDs.)
3) If you remove a child from the Parent that has the Animator Component.(This breaks the Avatar references as the animated vertices IDs are now out of order.)
I do wonder "why" did you remove the Animation Component in the first place since removing and adding it back does nothing productive?
I've made sure to do all of these things, but the problem persists. I think this may be a bug in Unity. In one of the tutorial demos I watched (Survival Shooter), the developer mentioned weird things happen if you mess with an Animator component for a model that was imported with its own animations.
I'm building a unity asset tool. One of the things it does is generate the Animator component. I did find an annoying work around. I created an empty prefab, copied an empty Animator component from a model into this prefab, and referenced the empty Animator component in this prefab. So now my tool gets a copy of the Animator component from the prefab and everything works.
Your answer
