- Home /
Replace Avatar in Animator at runtime to create character configurator
I am working on some character customization. I am currently able to create Avatars from code (via the AvatarBuilder.BuildHumanAvatar API) which have the correct proportions and work fine with Mecanim.
However, I find that when I create those at runtime and assign them to an existing animator, the new Avatar is not taken into account.
What I have to do is destroy the Animator component, create a new one, and then assign the new Avatar. What's more, destroying and creating the Animator component cannot happen on the same frame. So I end up destroying, waiting for the next frame, and then continue the rest of my setup.
There doesn't seem to be anything in the API which could help me out. Rebind() for example sounds like a candidate, but doesn't end up working.
Is there any way to have an existing Animator understand that it should work using the newly supplied Avatar? I don't even mind if that implies it will restart the current controller/animation.
Your answer
Follow this Question
Related Questions
Mecanim not playing animation correctly 1 Answer
How to use AvatarBuilder.BuildHumanAvatar? 3 Answers
How Unity define transform.forward of humanoid avatar with root motion? 2 Answers
How to manage these animations and avatars? 0 Answers
Parenting generic weapon to Humanod breaks Humanoid's animation 1 Answer