I had a Sprite Atlas file. My project needs to be work with Facebook SDK, so I imported Facebook SDK. After then, I don’t know why, but my sprite atlas file was corrupted. About 6~8 sprites were missing from the atlas file even I didn’t touch at all. I already made a thread about this, so I’m not gonna mention in here. I attached a screenshot at the moment.
The problem is, I just want to fix that file, so I bring the uncorrupted file. I’m using multiple branches in my project, so I just go to another project which set to another branch and has uncorrupted data, copy that file and move back to the current project and paste it. Of course, include metafiles.
And then switch back to the Unity and select my atlas file, but it’s still broken. Still, lots of sprites were packed in Sprite Atlas are missing. So I just compare the changes use GIT, but nothing was changed! And after saving my project by Ctrl + S, now there is a change but my sprite atlas file goes back to the corrupted state!
Why Unity won’t allow me to fix that corrupted one? Even worse, Unity suddenly said that the prefab file was corrupted and crashed! (Attached screenshot)
Looks like something goes wrong very seriously in my project because I already delete the whole project and cloned twice, it still happens. I can’t proceed to develop my game anymore, it keeps going crash and data goes corrupt!
I have no idea what should do right now. What am I suppose to do?
Is there a .meta file for that atlas? Are you swapping that in along with the old spriteatlas itself?
I’m not sure if Unity changed the internal GUID on some of your images, such that the sprite atlas can’t resolve them anymore. Would it possibly be simpler just to cut your loses, delete the spite atlas entirely, and just remake it?
Yes, there is a metafile and I copy them together. I just replaced the corrupted one to the normal one. I don’t want to remake the file because every branch using the same file and can cause conflict future. Also delete the atlas file and metafile and reimport doesn’t work either. I’m not sure but looks like Unity has an internal cached version of the files and force to update the current one.
I just delete the whole project and revert all changes since the data corrupted, and cloned back. The problem still happens. I attached screenshots, the first one is explaining two branches: Master and Android. I have multiple projects and each using different branches for the support of different platforms. There are some few more commits in Master Branch but it’s not important, I didn’t touch the corrupted files.
Now run the Unity and load Master and Android projects. The second screenshot shows the missing data. Both branches are in the same commit, but in the Android branch, data corrupted.
I didn’t touch anything, just re-clone the repo and open it to Unity right immediately and that’s it. The third screenshot shows the result of “git diff”. There are some changes but that’ doesn’t matter, important thing is that there is no change in my atlas file.
Just found that some script data also corrupted, which uses the same sprite in sprite atlas. Nothing touched, no git changes, but the data missing. Attached in the fourth screenshot.
I just delete the whole android branch project and cloned from the master, renamed folder name to Android, open it to Unity, data corrupted.
So delete them again, and this time I just duplicate local projects which cloned from the master branch renamed the folder name to Android, open it to the Unity, data corrupted.
So delete them again, re-replicate local master project, named to something else, like AOS, open it to the unity, now data not corrupted.
I’m not sure but seems like the Unity has some kind of internal file tracking system and it keeps back to the previous one. I thought that the problem was solved, but actually is not.
I just update the branch list from git, suddenly there are a bunch of file changes, data corrupted again.
Current what I tried:
Clone Android Branch → Tried 4 times, data always corrupted
Clone Master Branch and Renamed folder to Android → Data corrupted
Duplicate Local Master Branch Files and Renamed folder to Android → Data corrupted
Duplicate Local Master Branch Files and Renamed folder to AOS → Works, but after some git commands(delete local/remote branch), again data corrupted.