Overlay scene click problem

I have 2 scenes and they are overlapped with eachother, the if I add an image onto the top one, the clicking event of the image will also trigger the buttons in the underneath scene, how to prevent from such situation? thanks.

Hello @jcyuan,
I don’t actually think this might be the solution for your case but can you try
this.input.setTopOnly(true); on your scene’s

I have the same 2 scene overlapping, I’m always while focusing one disabling other’s input events

thanks for your reply, actually there is an API setGlobalTopOnly, but it’s true by default and does not work for my case, not sure if I set something wrong…

yes your solution should work, disable the current scene while `pop up’ some other scene, but… sorry actually this way is a little bit inconvenient.

Ok, I think I found the exact reason for my problem, you have to set a big gameobject to be interactive so that the event won’t pass to another scene, the update method in the InputPlugin processes the steps below:

count -> check if down on some gameobjects in the current scene
count -> check if move on some gameobjects in the current scene
count -> check if up from some gameobjects in the current scene

if the counted result larger than 0, stop the event to be pass to another scene, otherwise pass as normal…

so… solution is simple. put a ‘fullscreen’ gameobject to be as background…

1 Like

Yea make sense actually, buy my second scene is my UIScene so i actually can’t use a fullscreen background object. But also would be usefull in future I’m glad that you figured and write down here :slight_smile:

If the underlying scene doesn’t need to do anything at all, you can pause it.

Or set

underneathScene.input.enabled = false;
1 Like

i used a transparent image object hehe