We just started working with the Unity animation system, it’s good but it has many strange quirks. The problem we are having now is that we have a game object that contains multiple body parts (this is a 2D game). Now if we add the Animation component to the root object and start animating everything is working fine. However, as soon as we rename a child object the animation curves for that child object gets cleared out. Renaming the object back fixes this and they return, so it seems the animations for the child game objects are stored by name in the AnimationClip file. Also the same thing happens if we change the hierarchy for the child game objects.
This is really bad I think, is there some way you can copy the curves from one game object to another or move them to a different game object? If we need to change the name or structure of our child game objects we could potentially loose hours of animation work.
I just ran into this issue, big issue! I spent hours animating a bone tree (30+ bones) and decided to rename things for cleanup from auto gen’d bone IDs only to find the animation is now completely broken… grrr
To show how bad this issue can bite you, take a look at this bone chain and animation:
animation window:
It seemed like a great idea to rename all those bones to something like BodyBone1/2/3 or TentacleBone1/2/3 etc. after renaming the animation is not associated w the object anymore and worse, no idea which UniBone_1231283 goes to which bone I renamed so no way to go backwards. I had long finished renaming and doing other stuff in the project so couldn’t even Ctrl-Z it
Unity please fix this. it’s sad to see so many people running into this problem and nobody has any answers. This is a problem that is clearly not addressed. For such a basic functionality too. im tired of editing the animation files in a text editor every time I want to rename gameobjects…
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.
After renaming CameraController to CameraController1 in the Hierarchy window, the animation is lost (marked as yellow).
In the Animation window, click the same GameObject and rename it to CameraController1.
Under editor preferences change the serialization option to force text.
You can do find and replace to fix references, and even reorder the hiearchy as they contain the path to objects.
The ability to edit structure in editor would be nice. But until they add it, the best approach is to use a bit of planning so you don’t have to reorder. Or use empty objects as containers.
Thanks, the solution works for some parts but not when renaming parent objects. Say you have 2 objects:
Mob1Torso → Mob1Arm
and then you rename Mob1Torso to Torso. The animation for Mob1Arm is now broken and it can’t be linked to the new Torso object.
Yea… That can happen, sometimes it can be fixed by renaming the path in anim file. But not always, I am not sure why. At some point within the last several versions of unity, something has changed or picked up a bug or two. Anims and/or the controller been becoming more unreliable and fragile.
Had the same problem and was flailling around but found a solution from user khan-amil /thanks:
The tool / solution
There seems to be a bug in the editor (unity-5.2.3). Check the following to reproduce (don’t do this with your good animation, you reproduce a bug, even when you can fix it now):
{1} Go to the animation window, click on one animated object, and hit F2 (or click twice to rename).
{2} Now rename it to anything.
{3} Object should turn yellow now and you see the path, an additional slash (/) was added.
{4} Rename it back: you see there is now yet another slash, i.e. renaming always adds a slash
{5} Since you cannot remove the wrong slashes by this method, your path is broken.
Example: You have Alice/head. You rename “head” to “hat”, now the path is “Alice//hat” and when you rename again it’s “Alice///head”, but you can’t go back to “Alice/head”. With the tool mentioned above you can conveniently correct the paths (and rename) to your heart’s content.
/first post. Since I found this post easier, I thought I add what I found.
You can work around this by editing the actual animation file to remove the slashes… however if you change the total length of the names, the file breaks. I wasn’t able to figure out how to work around that except to manipulate it in the editor to make the length of the name I put in + however many glitch slashes adds up to my new name… but that can’t work if you want a shorter name.
I just don’t get why this hasn’t been fixed yet though. The issue should be fairly easy to fix. There’s multiple options:
fix the rename code so that it doesn’t add an extra slash
expose the full path in the editor so that we can manually enter it (this also allows for retargeting curves to similar objects with different parents)
Make it so the animation system isn’t oddly dependent on the length of the file so that we can manually edit these with text editors reliably. (then it would be easy enough to build an editor extension in unity to solve this)
Even then, you can only edit the names to become bigger (unless you found a way around this? if you did, let me know… I might try to create an editor extension to help us fix this problem… it won’t be as good as Unity just taking care of it the right way… but it’ll be something)
Typical rule of thumb when animating in unity, be very careful where unity creates or you create your animation controller on. if you start building your animation with the wrong controller, or have your controller on the wrong game object, you will not be able to move that controller on a different game object after you have made the animations. but if this does happen to you and you have made an elaborate animation that you would rather not redo, here is how you fix the problem:
We will be editing the actual animation files so make sure you have your original animations duplicated so you have a backup:
so we want to open these animation files in a notepad application but if you did that, you would most likely get a long list of binary, so to convert it to something we can actually read, just open up your editor settings and change Asset Serialization to “Force Text”.
Now we can go ahead and open these animation files in Notepad. once you have them open scroll down the animation file untill you find the “path” we want to replace the game object that the path is assigned to in this file with nothing. so do a find < Replace All and replace everywhere it says the first game object in your path to nothing (and remember to include the first / when replacing all). This will enable you to move your animator component to any game object parented to the objects you are animating:
After you have completed this you may delete the original animation files and you can re-hook your new edited animation files into your animator and you can move your controller.
I can’t believe this issue is still open. It’s incredible annoying and makes the whole animation-workflow borderline unusable. Throw in the inconsistent undo-behavior and the occasional update-glitches of the inspector (highlighting attributes red although they aren’t animated) makes animating in unity a real pain.
It keep wondering, if the people who patched this piece of **** together ever had to work with it for themselves. They should be forced to. This is one of the ugliest areas of unity, indeed.
I know this is a very old thread, but I don’t think things have changed a lot in this regard and finding this helped me (almost) to solve my reparenting problem.
Here is what I did:
Reparented object in Unity (in my case I added a root GameObject to it, but you could go from a flat structure to a “bone” hierarchy if you want to)
In the Editor panel, changed the Asset Serialization to Force Text (Project Settings->Editor)
Opened the .anim file (for each animation) in my case in Sublime Text but you can use plain text editor
Applied Find and Replace All to the file changing "path: " by “path: Root/” (in my case, if you want to parent just the arms then you need to adjust your search query accordingly, or do it manually one property at a time. (Follow what @Galactic_Muffin said)
And here is what did the trick for me: Open the animation you just edited in the Animation panel in Unity and move the the new object you added (in any frame, you are going to undo this anyway).
The last step was what updated the new parenting so all the old rotations and translations would refresh and playback as intended.
Hope this help someone trying to get around this issue!
Note: this is specially useful if you have rotations in your animation