How to restore a corrupted prefab from a VCS?
Unity decided to hang and required me to force kill it leaving a couple of prefabs corrupted and gray'd out. I have one under version control and would like to restore it. I have attempted to delete the prefab and meta file and then perform git checkout -f <file>
which does bring the file back but unity still sees it as empty. I've also tried checking out an older version of the project with no change. Unfortunately the file is in binary format so I can't easily inspect what it's contents look like.
Any suggestions on how to get unity to see the prefab correctly?
Answer by LessThanEpic · Aug 25, 2015 at 03:22 AM
Did you also "git checkout" the meta file? The meta file is what tells Unity that it's the same prefab, so if you don't get the right meta file Unity will consider the prefab to be a different prefab than before.
What do you mean "unity still sees it as empty"? Do you have a screen shot?
I don't have a screenshot since I gave up and ended up remaking the prefabs. Basically Unity shows the prefab as gray rather then blue and does not give a drop down arrow. When I tried to move it into the scene nothing would happen. Attempting to instantiate the prefab at run time would either give an error that the prefab is null or give an invalid cast exception.