Disable click on objects below another object

When a click happens on one object, it gets registered on all the objects below it. I have a scene with a buttons. When a popup with button is clicked, we need to disable the click on the scene button. I have tried the following:

  1. Hide/Show objects but the click is retained.
  2. Put objects in different layers but the click is retained.

I’m thinking around the following solutions:
z-index: somehow detect all objects where my mouse pointer/touch is and click the object with highest z-index.

Variable: use flag and solve. Doesn’t seem very relevant here.

On the scene buttons, add conditions to check that popup is not visible.

Hi,
I have same issue.
When clicking a button on base layer a small popup appears (as popup layer) where player can make a selection.
Unfortunately, the other buttons under the popup layer (buttons on base layer) are clicking too.

Move the buttons so that they are not on top of each other, it’s not a solution either.
Because when moving outside the popup (popup is still visible), I can click everyting on base layer.
I don’t want this. How to solve this problem?
How to stop a layer to interact? Hide layer or setting time scale to 0 doesn’t help. Buttons stay active.

@Gruk can you explain ‘On the scene buttons, add conditions to check that popup is not visible’?

Thanks

Hi and welcome!
There is a condition to check the visibility of a layer.
Use it to allow clicking the popup buttons only when the popup layer is visible, and allow clicking the other buttons only when the popup layer is NOT visible (invert the condition).

Thank you for the help.
Made as mentioned and everything is fine now.