Viewing post in 8-Colors Star Guardians comments
Thank you very much, I see an interesting crash report in your logs:
USER ERROR: Condition "slot >= slot_max" is true. Returning: nullptr at: get_instance (./core/object/object.h:972)
This is 100% the cause of the crash, though I cannot cause it to happen on my PC consistently. Apparently, it has something to do with a known bug in Godot 4.0. I will try to use one of the workarounds I found in the documentation and report back.
Did the crash happen mostly between scene transitions?
UPDATE: I could reproduce the crashes, if they happen at scene change. Godot crashes without showing any error, the one I thought to be responsible was a red herring, so I assume it must be an unlogged bug.
I might have pinpointed the cause of the error in the cleanup code on scene change. I have updated the build accordingly, see: https://dermondhase.itch.io/8-colors-sentai/devlog/538042/solving-some-underhand...
Hi, I am replying from my other account. It was a bug solved in Godot 4.2 related to change_scene. If you can't upgrade, the way to fix it is to avoid using the built-in change_scene and instead have a main scene with a parent Node and your current scene as a child. When you change scene, you delete the child normally and then swap it with the newly loaded scene that should replace it. This solved the issue in Godot 4.0 for me!
Please do note that this bug ONLY happens in release versions and NOT in Debug/in-editor versions!
My pleasure. Let me know if you still have troubles, worst case scenario I can simply show you my code!
Here's how I set up my project: SceneManager is a singleton that implements the goto_scene method. When the method is called, it emits a signal "switch_scene" which is wired to another goto_scene function in the MasterScene object. The MasterScene then frees the current scene (the only child) and instantiates a new child with the required scene type.
I hope this helps!