Severer Unity 4.6.8 Import BUG?

I just stumbled upon something very weird:

  • I have an existing project containing a class (split into several partials) called LocomotionU. The primary file name matches the class name and is named LocomotionU.cs.

  • When importing a package containing the latest UMA GIT project, Unity will overwrite the contents of LocomotionU.cs with an imported file named Locomotion.cs containing a class definition for Locomotion.

This happens despite there being no conflicting paths or names that could be the cause. So why is Unity seemingly randomly overwriting one of my class files…?
I have managed to reproduce this during repeated attempts to avoid the problem.

Thanks in avdance!

This sounds like an interesting bug.

So what your saying is - you have a c# script called LocomotionU.cs in your project, and that when you import UMA into your project, it overwrites the contents of LocomotionU.cs with another files contents? So when you then open your script it contains the same code as Locomotion.cs which comes with UMA? Am I understanding correctly? If so that is very bizarre!

Yes, that is exactly what happens. It is extremely bizarre. The problem persists even if I delete the Library and temp folders (we use Plastic for version control so text serialization is forced, and no Plastic is not allowed to do anything during this, so this is a Unity internal problem.).

I guess I will have to manually move the UMA folders into the project to avoid this. But it is very scary and I would appreciate if someone could take a stab at explaining how Unity could link two classes and files that have nothing in common and overwrite one with the other.

I found the cause. The reason is an old guid ID in the metadata that came with the original Locomotion.cs file. I continued work on that file, and it seems Unity retained that guid since then. So on import the guid “collision” will cause the problem. Which is an intended behaviour really.

Lesson learned: copy code if reworking another class, do not move or continue work on the same cs file…

Hmmm so it turned out to be Metadata causing the problem?