- Home /
Getting "Failed to Unpersist" Errors that are Destroying my Scenes!
Hi there!
I'm having a bizarre bug in the editor when I try to play a scene that is deleting many of the scene files, even when I exit play mode. This is slowing me down by huge amounts, as the only way to get the deleted objects back is to completely unload and reload the scene each time this happens.
Typically, first I get an error that says: Assertion failed on expression: '!prefabInstance.IsPersistent()'
That is followed by hundreds of 'Failed to unpersist: MonoBehaviour ID: -372070 FileID: 530456694' - each with a different file ID. I've looked around and only seen this issue pop up a few times, but none of the fixes have solved my problem.
The distinct things that I've noticed about it:
- The issue only happens in a scene when I'm working with multiple scenes at once.
- All of the objects in a scene get nuked only if I have an object in that scene selected before I hit play, which is most of the time when I'm working on a scene. But if I select an object from a scene where this doesn't happen and hit play mode, it seems to be alright.
- I've tried, duplicating and renaming the scene, doesn't seem to fix it.
I'm using an edu copy of Unity 2018.1.2f1, using github to work on the project collaboratively. (Could it be a merging issue from Git? Not sure how to figure out if that's the case.) I'm using a plugin called AMS, which is for doing multi-scene cross-referencing, and I thought that might be part of the issue but I've tried turning it off and that hasn't fixed it.
If you have any sense of some steps I might take to solve this problem that would be a huge help!!
Thanks.
I'm getting these in all 2019.1 and 2019.2 versions. Not sure why. It's not consistent. I restart Unity when it happens, without saving. Didn't know about the ability to reload a scene to get back the missing content.
Answer by wfreudenheim · Oct 23, 2018 at 07:12 PM
For what it's worth, I noticed that when this happens it resets a prefab in whatever scene rather than deleting it. When I delete the parent prefab in the hierarchy so that all of its children in-scene turn red and lose their links, the problem stops happening. However, when I try to do it properly with Gameobject>BreakPrefabInstance, the failed to unpersist errors pop back up. This feels like a half-fix, but having a scene full of these red broken prefabs does not feel like a real solve. Maybe this will help someone figure out a solution though.