Stop an object from being clicked on overlapping layer

I have two clickable objects with interactions. One object sits in a UI layer (let’s call this layer A) and is fixed. The other object sits in the layer below (layer B) and is scrollable. When both objects overlap each other, clicking the object on layer A executes the interactions for both objects.

How do I stop this from happening?

Whatever logic you have for them
Add to them
Layer visible condition

For one on layer A add condition layer A is visible

For one in layer B add condition INVERTED layer A is visible

Layer visibility won’t help if one layer is a UI and the other layer is a visible scrolling play area.

@patrickwelham, I’d put all the object clicked events in order that they should be checked. I’d also add add a variable to indicate whether another object has already been clicked. Something like:

Somehow i understand from Patrick message one is visible always and other not

After re reading his question IDK how i came up with such conclusion

I’ve done that many times too. Good thing we’re here to catch one another :grin: