KybernetikGames / animancer

Documentation for the Animancer Unity Plugin.
63 stars 8 forks source link

How to change root of animation for preview? #339

Closed wrymn closed 3 months ago

wrymn commented 3 months ago

I have a following setup, where all the character components, with references to animation clips are on root of prefab, as is a standard.

However my character model, is ofc put under a specific child.

Now my question is, how to preview animation for the prefab model? Because:

KybernetikGames commented 3 months ago

The Animator component definitely needs to stay on the model and the AnimancerComponent should be with it. That will have the Animation window call AnimancerComponent.GetAnimationClips to gather the animations for its list which first uses the rules explained in AnimancerEditorUtilities.FindRoot to figure out which object is the character's root, then gathers all animations under that.

Try implementing ICharacterRoot in one of your components attached to the root of the prefab. It should already be finding that object because it's inside a prefab, but there might be a bug in the code.