- Home /
How to fix bizarre mecanim behavior that occurs in build?
I hope someone can help me with this, as I've searched extensively but can't find anything in Unity documentation or right here in the Unity community that sheds any light on the issue.
I've been working on my game for many months now, but I foolishly had neglected to run regular tests in the build version, only in the editor.
And everything works 100% fine in the editor, but I'm getting really weird results in the build versions (PC and Android).
My game's main character is animated by mecanim, and uses several animations to function throughout the game.
But when I run the build(s), he only undergoes the idle animation, even when he's supposed to run, punch, shoot, etc.
The really strange thing is that the root motion for the animations is performed correctly, even though he's only swaying a little back and forth.
For example, when he's supposed to run, he only sways back and forth in his animation, but the model moves forward as if the correct animation was playing. Ditto for the lunging punches, etc.
And again, this only happens in the build versions--in the editor everything works fine, as he's running and punching and shooting and falling over, etc.
This occurs with both Unity 5.6 and 2017.1 (the only two versions I've tested this with).
It would be wonderful if someone could help me solve and fix this mystery, or at least point me in the right direction.
Thank you so much!
Have you tried script debugging with Build? I'd suggest that you take an empty project and try to build a sub set of the player mecanim and try to run that in build mode, it'll help you in understanding the problem better,
I've not seen this type of problem in Unity, There could be some flag which if you set will stop animations from running in your logic, make a subset and try to run it.
Answer by dshillady · Aug 10, 2017 at 08:09 PM
I've determined the cause of the problem, even though I don't understand exactly how it led to the behavior it did.
My main character is part of a prefab, including the main GameObject, the 3D model, a base circle, and several scripts.
It turns out that I had my animator component on both the main GameObject as well as the 3D model.
I guess the competition between the two caused the weird results.
After removing one, all is well now.
Thank you to everyone who took the time to consider this issue and help.
Answer by theANMATOR2b · Aug 08, 2017 at 07:24 PM
Maybe something in your build settings that is culling or compressing the animation quality?
Your answer
Follow this Question
Related Questions
Access Animation States in Mecanim at runtime 1 Answer
Distribute terrain in zones 3 Answers
Mecanim controller not working in standalone 1 Answer
Mecanim BlendTree non-linear behaviour? 1 Answer
Unity4.3 legacy animations... 3 Answers