- Home /
Unity serialization problem "deleted gameobject"
Without any apparent reason my unity project stopped working correctly. Everytime I try to switch scene with
Application.LoadLevelAsync (levelId);
or
Application.LoadLevel (levelId);
I can't click any object in the scene and the hierarchy shows "deleted gameobject" on every single object:
the debugging log shows a lot of spamming of the following:
Unloading 0 Unused Serialized files (Serialized files now loaded: 0) UnloadTime: 0.549058 ms System memory in use before: 36.6 MB. System memory in use after: 36.6 MB.
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 1280. Total: 0.568947 ms (FindLiveObjects: 0.042188 ms CreateObjectMapping: 0.023505 ms MarkObjects: 0.489692 ms DeleteObjects: 0.012958 ms)
Unloading 0 Unused Serialized files (Serialized files now loaded: 0) UnloadTime: 0.552674 ms System memory in use before: 36.6 MB. System memory in use after: 36.6 MB.
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 1286. Total: 0.486377 ms (FindLiveObjects: 0.037970 ms CreateObjectMapping: 0.021094 ms MarkObjects: 0.413752 ms DeleteObjects: 0.013259 ms)
Unloading 0 Unused Serialized files (Serialized files now loaded: 0) UnloadTime: 0.597575 ms System memory in use before: 36.6 MB. System memory in use after: 36.6 MB.
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 1292. Total: 0.582809 ms (FindLiveObjects: 0.042791 ms CreateObjectMapping: 0.021395 ms MarkObjects: 0.514704 ms DeleteObjects: 0.003616 ms)
Unloading 0 Unused Serialized files (Serialized files now loaded: 0) UnloadTime: 0.533086 ms System memory in use before: 36.6 MB. System memory in use after: 36.7 MB.
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 1298. Total: 0.547551 ms (FindLiveObjects: 0.040380 ms CreateObjectMapping: 0.022601 ms MarkObjects: 0.471310 ms DeleteObjects: 0.012958 ms)
Is this a bug in Unity? I'm using Unity 5
To save anyone else with my same problem some time: as a workaround I disabled every asynchronous level load and the problem seems to be gone. It might be only related to asynchronous level loading.
Answer by xiaolangfensi · Apr 12, 2017 at 05:50 AM
Maybe you limit the amount for prefab to Instantiate and Instantiate the object on update?