Animations and Unity Version Control

I’ve got an FBX of a monster with a bunch of animations. I had edited the controller very mildly, simply adding the animations so I can call them from script, and then adding an event to a bunch of them to call a function in a script. That’s it.

I then edited the FBX, simply adding new animations (I did NOT edit old animations, or change names). I then deleted the FBX in Unity, and dragged in the newly exported FBX (same name as the old one), so that it would be used in the same spots. If there’s a better way to do this, please tell me.

I’ve done it before, and it worked. All I had to do was add the NEW animations within the controller.

My problem is, when I did this (this time), it deleted the events I had created, and remove some connectivity in the controller (the animation reference was removed from the “motion” slot, so I just had to re-add it). Firstly, why is simply updating the FBX deleting my connections, and removing the events? Is there a better way to do this?

Secondly, and this is the real problem. I had created a Unity Version Control (UVC) backup (let’s call it backup A) before I deleted and reimported the FBX, where everything was working fine. I then deleted, imported the new one, and did some edits to make it work. I then created a new back (let’s call it backup B). I then loaded backup A to check something, then reloaded backup B to continue working. However, backup B is missing a bunch of work I did in the controller to get it working. As far as I understand (and I’m a noob), UVC should include all animation controller work. So why did it delete my work? I deliberately created a backup before messing with stuff, then created a backup with all my work I could come back to.

I’m probably just not understanding something properly, because I’m a noob.
If there’s a better way to import an updated FBX, or use UVC, please let me know.
Anyone know why these two problems happened, and how to avoid them in the future?
I apologize for being a noob. I’ve tried to figure this out myself, and haven’t been able to.

Thank you for your help!

How did you delete the old one? Did you do it from within the editor or did you do it outside the editor and then return to the editor before replacing it? If so then you basically boned yourself. The meta file associated with the actual file will be removed in both scenarios and that is what is used to link to everything in your project.

There is no reason to delete the original file. Simply save over it. As for updating newly create animations - I’ll admit that is a huge pita. Luckily, there are solutions to that as well. All you need to do is update the meta file’s data to reflect what new animations have been included. You can do it manually or course but automated tooling is a much smarter idea. If you check the post I’ve liked below there are several iterations for a tool that does just this. I’ve taken this tool, modified it to add many features I wanted for myself and have been successfully using it for over a year now.

I can’t help you with UVC unfortunately. I’ve never used it.

This breaks any references (links).

I don’t understand where this is coming from but every month or so there’s a user doing that for some reason.

=> You can and should overwrite files (especially assets in a Unity project).

In Unity, if you delete an asset, all places where that asset is referenced are unliked. Gone for good. Nothing puts those back based on path/filename alone. The FBX you put back in its place is considered a new, unique asset that has never before seen this project (and vice versa). You have to re-assign everything manually.

I’m curious where and why you formed the habit that you first have to delete a file (asset) in order to replace it? I just like to understand where this is coming from. It may have a common source if that’s a workflow frequently used by some users.

Yup that answers the first problem then. I was deleting it badly. Great to know the proper way, thanks! I’ll just drag my new file into the actual folder with the old file, and say overwrite.

To CodeSmile, I’m not really sure. It might because Unity has a hard time recognizing when you make changes like that, and so deleting it forces it to recognize a change has been made? But I know there are easier ways to do that, like clicking reimport, but I’m also scared of that because I feel like Unity is going to break everything no matter what I do, haha. At least now I know I should overwrite the file, from within the windows folder directly.

If anyone knows how to help with the Unity Version Control, that would be tremendous! I used it exactly how it should be used, and it totally ruined my work. If I try to rely on it in the future for something bigger, that could ruin tons of work. It’s probably me using it improperly, but I don’t know what else to do.

I suspected as much.

There is some confusion as to why some changes to FBX don’t get picked up. They’re typically a workflow problem.

Like when you have a prefab instance in the scene that has modified changes ie mesh changed to capsule, then the overwritten FBX will show up in the prefab but not in the scene because of the override. Renaming things in the 3d model or structurally changing certain things (ie add/remove submeshes) can cause those issues.

Having asset refresh disabled is another potential cause of changes not getting picked up. Or if some program has a lock on the file then Unity can’t import it, and probably logs that in the Console.

Reimport never breaks anything that wasn’t broken to begin with. :wink:
A full “reimport all” aka “delete the Library/” is actually a common troubleshooting step for “inexplicable” issues.

Just wondering, if I fully close Unity, and reopen Unity and my project, will that fix all these issues as well? I’m actually just terrified of breaking everything now, so if waiting a few minutes for everything to load back up will fix it without risk, I’ll just do that, lol.

No.

This is acting out superstitious behaviour. That always conflicts with technology work. To cope with fear of uncertainty, you have to eliminate the uncertainty in the first place. Don’t even let it become a mysterious thing where full-moon + animating has Unity lose your work. Investigate, analyze, research, form a hypothesis and test it the first time something out of the ordinary happens to learn what’s causing it, how to fix or avoid it in the future.

For instance, if you have an animated character and everything works fine, rename an animation or a bone ie just changing idle to Idle or Hipps to Hips and things will break once you import that in Unity. The cause is obvious. The problem is only that it may happen minutes, even hours after you made that change in Blender while also making dozens of other changes.

Source control also helps in that process as you can review exactly asset by asset, line by line what changed and how.