Prefab Disconnect

Something that happens to me frequently (1-2 times a month) is that my Unity project will suffer some horrible crash, and when I restart it, it fails to load anything correctly. No external packages will load, and I have to create a whole new project and copy over my data.

The side effect of this is that all my assets become disconnected. All prefabs saved within levels disconnect from their prefab-original, all assets lose their meshes, and all materials are dropped as well. This has been a consistent problem with Unity for me, though it hasn’t bothered me much until my projects grew to a size that makes this unmanageable to re-connect everything by hand.

Since I am using a large amount of prefabs, I feel like there should be an easy way to reconnect them that I’m probably ignorant of. What I am seeing is that my prefab objects (in the scenes hierarchy view) are displayed in red text. I assume this means they’ve lost track of their original file. Can anyone offer a suggestion to easily reconnect these? How do I get an asset displayed in red text to reconnect with the prefab file on disk?

I would really appreciate some help with this. Many thanks in advance.

Someone please help me with this. It’s a serious issue, caused by internal bugs in the tool, and I’ve put up with it for months. I would appreciate some insight, even if it’s just to fix my broken scenes and get back up to speed.

Thanks.

After a “horrible crash” what exactly fails to load? Scenes? What do you mean by external packages failing to load? When you copy your data over to a new project do you use export/import package or do you simply copy the assets into a new Project?

Several things fail after the program crashes in this way:

-My layouts revert to some default view, and when I attempt to load my personal layout, it gives an error such as: “Failed to destroy view #n

-Any packages that I have imported from the asset store fail to load. Furthermore, the packages cannot be reimported into the project. Reimporting them appears to work, scripts compile, packages are unzipped, progress bars progress, but nothing in the editor changes. Example, I use the PlayMaker plugin, which has it’s own windows and a pull-down menu. None of these appear, despite the appropriate folders and files existing in the project view. This may be related to the problem described above.

-The scenes will load fine, but all assets in them fail to do so because of various disconnects. Example would be any meshes that I imported into the editor from 3ds Max: the gameobjects which represent these assets are still in the scene, but viewing them in the inspector shows that, in the case of a Mesh Filter component, the Mesh attribute is labeled as “”. The same goes for any other connection to an external asset. The materials are all “”, all textures and fonts in my GUIskin are “”, and so on.

I can manually reconnect any of these by going to the project view and dragging each mesh back into the MeshFilter component on each and every gameobject in the scene that uses it, by hand. Same for textures and all other assets, but when you’ve worked up to several thousand assets spread across several dozen scene files, this is no longer a valid manual process.

Things that remain intact: All objects still appear to be in the scenes. The scenes themselves do not break or error, and scripts and other gameplay related data is still present. Additionally, any Unity-created components (boxes, spheres, etc) are still present and do not have a “” attribute in their respective components.

Regarding the prefabs in these scenes: my prefabs are displayed in red text within the Hierarchy view. They also lack the usual buttons of “apply”, “select” and “revert”, they’re just not displayed. Using the pull-down option of “Revert to Prefab” in the component options menu does nothing.
If I drag a prefab object from my project view into the scene, it also has each of its component attributes labeled as “”, as though each prefab in the scene dropped all its connections, and then applied the change to the original.

Regarding importing data: once this crash occurs, I can no longer export the project because of all the issues I have detailed above. Instead I will create a whole new project with the same name, import all necessary packages/plugins to the fresh, new project, and then copy the old project folder over to the new one. This fixes all issues with the exception of the disconnected assets.

Thank you very much for your help. I’m sorry to be so pushy, but this has the potential to be catastrophic to my project, time and money. once you’ve invested so much into this program, having it destroy all your hard work is very hard to deal with. If I’ve left anything out or can provide more information please let me know. I am very eager to resolve this problem so it doesn’t happen again, or at least allows for an easy recovery.

Thank you again.

Any further recommendations for this?

For the time being I’ve moved my development to OSX. We’ll see how that goes.

Hello Artician,

I’ve not experienced this problem myself, but I have an idea how you might prevent the disconnect problems you are seeing. We use unity with external source control enabled (Edit->Project->Editor), this has the side effect of storing all of the meta data associated with each asset in it’s own .meta file (otherwise, I believe Unity stores this somewhere else, no idea where). This meta data includes a unique identifier which unity uses to link assets together, such that if it were to move location, as long as you move the meta file, the asset will be identified. We have encountered problems like yours when meta data has been removed, or not checked into source control (including meta data for directories!). If you have the pro version of unity, and are not using the asset server, you could try enabling the external source control option. Or use the asset server and regularly backup your work, and if it goes wrong, revert to the backup.

Hey Bangz, thank you very much! I’ve actually got another thread around here that was asking about the meta data location as well, that I never got a firm answer on. I’m glad to know source control can provide it in it’s own external file. That helps a great deal so I’ll look into it right away.

Out of curiosity, what external source control are you using? I’ll use the asset server for now, but I like having knowledge of where the meta data for my entire project is. It’s burned me in other ways before.

Thank you again.

Hi

I just hade the same problem my self. Found this tread while google for a solution. The last thing i did before shutting down unity while it still were working, was to rewrite a script by adding a code line with the text"waitforendframe". I closed unity, it asked me if i would like to save before closing, which i did.

When i startet unity again i hade the same problem as you. So i went in the the same script again and remove the textline “waitforendframe” which was the last one i wrote the last time. Then i selected my own layout, unity relaunch itself. And then everything were back to normal again.