[SOLVED]Scene Switching (Could be considered a bug)

I actually had asked about this in the “How do I” forum, however, I thought maybe it would be better if I asked about it specifically here.

When you switch scenes, and you have a button in one of them, the button is still active in the next scene. I understand that the mouse/touch input is always reading regardless, but the button shouldn’t be active in another scene, unless you’re somehow able to store a sprite object in a global variable (not sure if you can with GDevelop). I think this might be considered a bug. The active script should only be the current scene.

Granted in a regular programming environment you may have to manually deallocate memory, etc, or have an environment that does “garbage collection” for you. But considering this is supposed to be for everyone, any deallocation, or freeing up, or shutting down of items/objects should be handled by gdevelop itself.

Hmmm…without being able to see your project (or at least both scenes entirely) I can’t provide any more detail other than:

By default, event logic does not cross scenes. Even in the project JSON file itself they’re wholly segmented, as are objects. (You can even have project files split into multiple files, making it even less possible for events to cross scenes)

What does cross scenes is your specific inputs.

E.g. If you have the mouse button down, and have an event in Scene 1 that checks for mouse buttons, and an event in Scene 2 that checks for mouse buttons, those events in Scene 2 will still count the mouse button as down once the scene loads…because the mouse button is still down. So if you have buttons in the same location on both scenes, and a condition that checks for the mouse button down, that will activate as soon as the new scene loads.

This is normal, and also true for normal applications (therefore unrelated to GDevelop in general.) Developers usually have to account for this with toggle logic or having a strict requirement of “this interaction button cannot be used unless the mouse button has previously been released”.

As mentioned, unfortunately without being able to look at the full project in question, I can’t give more guidance on if you’re running into a specific bug elsewhere or not, or if this is something new that has cropped up.

Edit: Just removed what was here because I figured it out. You’re correct of course, it was another error on my part, yet again. So I have to disable the buttons in the scene.