2
\$\begingroup\$

I have an animation clip I made with Mechanim. But when I changed the hierarchy of the objects in the children, it stopped working!

The text says ( Missing! )

Why is it breaking? How can I fix it?

\$\endgroup\$
2
\$\begingroup\$

In Unity, Animations are bound by name, so if you change the name of any object, or move the object to a different parent (thereby changing the path), the animation will break.

Do not attempt to use a 'find and replace' feature with a text editor, as this is known to cause corruption.

Luckily, Unity has a built-in (though somewhat hidden) API for editing animations. If you have a big project and a team, one of your developers ought to learn this API and make an editor to handle this.

If not, you can use this free tool, which I have tried and works well (saving me hours of time by not needing to redo my animations!)

https://github.com/s-m-k/Unity-Animation-Hierarchy-Editor

(Note: tool is open source)

\$\endgroup\$
2
\$\begingroup\$

After changing the name of a GameObject in the Hierarchy window, you can click the GameObject in the Animation window and rename it to make them identical.

  1. After renaming CameraController to CameraController1 in the Hierarchy window, the animation is lost (marked as yellow).

    Example Image

  2. In the Animation window,double click (slow) the same GameObject and rename it to CameraController1.

    enter image description here

  3. Now the animation works again.

    enter image description here

\$\endgroup\$
  • \$\begingroup\$ This doesn't seem to work in Unity 2018.3.7f1. \$\endgroup\$ – MikeR May 5 at 17:46
  • \$\begingroup\$ I didn't checked on latest version of unity. I'll check and update my answer soon. Thanks \$\endgroup\$ – Faisal Imran May 29 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.