Botton from other scene are active

Hi, everyone. I´d like your help to solve this problem I have, please. ( English isn`t my mother tongue)

I have a scene with all their buttons that work perfectly, but when I touch on a part of the screen where there was a button from the previous scene, the action of the button is executed, it seems that the button from the previous scene is active in the following scenes, something that is really bad because, It is a button to change the scene and if I touch that specific part of the screen many times, (where there aren´t buttons) I change the scenes until the end of the game.

When I touch where the arrow is, I change the scene, but there`s no button there, the button to change the scene is in the previous scene.

Thanks for your help

Are you sure you don’t have anything wrong with your events? I have never encountered this issue, not even once.

If your are using different layers to show different buttons just check if the layer is visible then do actions
Suppose you have Level select 1 layer the level buttons goes from 1 to 10 and LevelSelect 2 where the buttons goes from 11 to 20
Then just put all your touch related events inside a main conditional event like
if LevelSelect1 layer is visible
Do your touch settings here

if LevelSelect2 layer is visible
Do your touch settings here

Thanks, I´ll try it.

How are you changing scenes? By loading an external layout, or a new scene?

Remember also hidden objects are still active and can take collisions, they’re just not visible.

I’d suggest you add a condition that a button is visible when actioning a button click.

Thank your very much for all your suggestions and advices. I checked again the scenes and the problem is related to the layers, what you said is true, the layer where there are buttons is not visible but, they are active, that’s the reason when I click on some parts the buttons that are in the not visible layers are triggering actions.

How could I solve that? Is it a wrong way to manage the layers or is it a code issue.

Thanks in advance!

Neither, it’s the way GDevelop works. And it’s useful in some situations, and a nuisance in others.

Well, I don’t no know if this is the best option but I decided to delete the buttons that aren’t used after a specific action and if I need a button again, I create one in a specific point where I need it and it works. Thanks.

You could have added a condition in your Button event which says:
Button.Layer() is visible

1 Like