Game Randomly Locks Up When Generating Scene Instances

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tyler

Hello everyone!

So I am experiencing an issue where several instances of a scene are being created within gdscript and my game will lock up at some point during this process. When it locks up the profiler does not show any issues occuring with frame time, physics processing, or anything for that matter. The game does not crash or stop responding, it just locks up. Up until the moment that the game locks up the FPS is always above 2000. I have disabled every part of my code except for the part that is calling .instance() on a scene resource that I have preloaded and then adding the new scene instance as a child of my level. Does anyone have any idea what could cause this? I saw a few topics online that seem to be vaguely related and the solution for those was something to do with call_deferred but attempting to replace all of my calls to .instance() and add_child() with deferred calls yielded the same result. There are no errors logged to the console at any point.

There are also a fair number of calls to .free() on Area nodes. I read online that this could potentially cause problems so people generally recommend using .queue_free() but my game produces the same freezing issue regardless of which one I use.

Also as a more general question, what types of problems could the user create which cause the engine to behave this way? Specifically instances where the game essentially breaks like this without logging any errors.


most common cause of game stopping in normal frame rate is yield()
Do You have any ?

Inces | 2022-08-17 16:17