It’s been going on for a long time and we don’t know what’s causing it. Sometimes I have no problems for months and sometimes it’s every now and then.
There are two things I want to talk about:
1-Sometimes Unity will do some kind of weird mass reimport that can corrupt some prefabs and we have to get a backup of those or else they’re lost:
Here is a before and after of an affected prefab (this one is always targeted):
All that is left is this.
2-Unity will mixes up references between similar instances of prefabs we have inside our Room prefabs and show theses changes as “overrides” even though we didn’t touch them at all:
We can’t afford to manually go into each of our Rooms and check every single reference of every single objects every time this bug happens.
This game project has been worked on for a few years now and went through 2 or 3 unity versions and several Plastic/VCS versions.
I have cleaned A LOT of files over the last few months and changed our folder structure to make it easier in the furture to work on, but also in hope this “magic” problem would go away.
These bugs have been there for a long time and we don’t remmember since when, but I do remmember at first I was the only one impacted on my team and eventually my coworker got it too.
After cleaning the project I made a clean reinstall of everything and settup a new clean repo in Unity VCS.
Last Summer I even built a brand new computer so even with everything fresh, this bug eventually re appeared.
I don’t really know what to do about it, I wouldn’t mind manually fixing things once and for all if I could have the guarantee of it not happening again.
We are using Unity version 2022.3.0f1 and VCS 2.0.7.
Edit:
After fixing by script all the problems I pointed out at number 2 of my post, I saved, pushed to my branch and then wanted to make a build.
After the build was done I saved again and closed unity, but first, the problem happened again and then Unity closed.
After launching Unity again I could see the unwanted changes in a lot of room prefabs:
Room prefabs are rooms that contain a lot of instances of other prefabs.
When looking in one of those room I could see random references here in there swapped between instances of similar prefabs. So this bug does in fact scramble things around.
If I try to look at the difference between before and after in Plastic, there are a VERY LARGE amount of fileID that change. Since there a lot of objects inside these prefab it makes sense.(I reached image limit so I can’t show you but for a single room there is 3284 pages to look at).
Edit2:
I made another build and then when I tried to quit it happened again. Building seems to put unity in a state that requires it to re import and in this case break my room prefabs. I know it can happen in other ways but it’s hard to find.
Update: Affected prefabs are the ones that are included in the scenes I am building.
Building an empty scene does not trigger a reimport of any prefabs.