- Home /
GameObjects deleted on scene load
Hi so in my 2D platformer, when I reload a scene, around 25-50% of the time certain game objects just aren't there. For example in this the gray square (which is an enemy) appears in the scene and is definitely there But as soon as the scene is loaded
The enemy is gone. Seemingly being deleted from the scene as it's not in the hierarchy. But when the scene is reloaded (which happens when the player dies) sometimes it's back and sometimes it isn't. This bug occurs about 25-50% of the time in both scenes that I have so far with various platforms, enemies, and other game objects, but it only happens with certain ones (for example that particular enemy will be there in the scene view when not playing, but gone when I press play. Another enemy will always be there when I press play, meaning it is never affected by this bug)
I have checked and checked again to see if anything in the code could be causing this but have come up with nothing. I've checked to guarantee that there is no difference between a game object experiencing this bug and a similar one that isn't. I'm thoroughly confused and have no idea what I need to do. Thanks for any help!
Also as a note, when these game objects are pasted into the scene during playtime they are immediately deleted and very briefly flash their names as 'deleted gameobject' in the hierarchy
This may be another problem entirely but I've observed that when a platform is deleted, the grounded variable on the player is always true until they land on a platform and jump again
Your answer

Follow this Question
Related Questions
UNET Scene objects not enabled on client at start 0 Answers
Load 2 scenes at once throuh scipt 0 Answers
Current Level Load Again After Level Completion 2 Answers
,I want to save the execution result. 0 Answers