- Home /
Prefab changes fileID and lose references randomly
Many prefabs of my randomly change their fileID or something and any reference to them become missing. It happens frequently and every time, I have to discard these changes or drag back references manually (which takes a lot of time). What's happening here?
I updated from Unity 2018.2 to 2018.3 which added Nested Prefabs. Also, I use Sprite Atlas. The affected prefabs contain both prefabs that use Prefab Variant and standalone prefabs.
Edit: This happened again today. I've made a git repository to show all the changes that caused the Missing references: https://github.com/cdr9042/temporary/commit/a71d2e483d4520352d27b03ea2e333fe435fca13
Having the same issue with couple of my prefabs in 2018.3 too.
So I exported my project (while on 2019.1.0b3) and imported it in to a fresh project (also on 2019.1.0b3), and so far this bug hasn't occurred again.
When you exported the project, did you export it along with the corrupted prefabs or you created new prefabs and then exported?
Answer by Bunny83 · Feb 24, 2019 at 01:31 PM
The screenshot you've shown doesn't show any issue. The fileID is an asset local identifier that is only valid inside that asset file. In the line 241 that Transform component gets its id within the file. In line 8 you have a modification entry that references that transform component. This can happen at any time your prefab is saved again. However this shouldn't break external links to the prefab.
Actual cross-references are always done using the asset id which is a guid. That GUID should never change unless you loose the objects meta file and Unity has to reimport the asset. In this case it's a completely new asset with a new GUID. So the screenshot you've shown shouldn't affect cross-references unless you just partially applied those changes which would of course completely break the prefab files internal structure.
You may want to read the documentation about the Yaml File format:
The first line contains the string “!u!1 &6” after the document marker. The first number after the “!u!” part indicates the class of the object (in this case, it is a GameObject). The number following the ampersand is an object ID number which is unique within the file, although the number is assigned to each object arbitrarily
So FileID references are always file local. If they change everywhere where they were used that shouldn't be an issue at all. As i said, actual references between assets (which include prefabs) are done using the actual Asset GUID which in your case are for example:
f178577529d3d44419f76fd4226e823e
and
f6ba31f0d1662934b91b7d486549e8e9
I have to admit i haven't looked into how they actually implemented nested prefabs. Maybe they have an issue there. Though depending on how many people actually use nested prefabs, it seems to work for most of them. So if you have issues i would guess you do something strange. Maybe an issue with your revision software.
If you have this issue again, can you manually search for one of the removed FileID in the newly saved prefab file? Unless the FileID has been reassigned to a different object (which is possible) there should be no reference to that FileID anymore. If there is a reference with that FileID but no object within that file with that ID there's most likely a bug in Unity. If you found such a reference in your file, you may want to send that file along with a bug report and make sure you include the line numbers and a description of your findings. .
I have a similar issue, and i have multiple prefabs with "!u!1 &1". When i select or try to open the prefab, the editor crashes. Is it possible to re-serialize the assets(prefabs in this case) with new and unique id's?
I think you didn't get what i said. The FileIDs are only unique within one file. If you have two seperate files (a prefab, a scene or another prefab) they can use the same IDs since they are only unique within the file.
Look at the example file they have in the docs. The IDs usually just count up. However there are special FileIDs which also encode a certain type. However the internal FileIDs have nothing to do with external reference errors since those IDs are only relevant within the file. If you find more than one object within the same file that has the same ID assigned, that would be an error.
Thanks for letting me know about this. But i cannot tell if a file ID is assigned or not. Please help. Here's the link to my question.
Thanks for the insight. This bug happened again today. I've made a temporary git repository so you can see the all the changes. Please tell me if you need any more information. https://github.com/cdr9042/temporary/commit/a71d2e483d4520352d27b03ea2e333fe435fca13
That's great, however the prefab is missing it's meta file and we don't have the actual reference to that prefab which is the actual issue ^^. Was the reference from another prefab or a scene file? Hopefully you never transfer / move / sync prefabs without their meta files ^^
Ok, I'll remember to record the meta files and the relevant object the next time this happens. The references is from a scene file.
Those files weren't touched at all, it happens randomly, sometimes I changes an unrelated animation file, then I save project and bam, all references lost.
Edit: I've uploaded the scene file which contains the references as well as the meta files. Same repository https://github.com/cdr9042/temporary
Answer by VEA_Games · Mar 25, 2020 at 05:35 PM
I have the same issue with prefab variations during last 3 months. I have no upgrades of Unity - it happens randomly. FileID changing and references are set to null.
There are two refs are now shows as None (sometimes as missing) https://gyazo.com/5f2d69d8a715484b5198a9f19aafc4f7
After I fix an issue, I see that FileID is changed (why?): https://gyazo.com/f2f91981f2e248c83b6a1e929c063784
The prefab variation https://gyazo.com/63dd80bd12ef37e7cb36b7df7faeee91 (prefab variation meta) https://gyazo.com/179f74aaf052340666b3b31357d0c658