Execute code when clicked anywhere except on UI buttons

In my mobile game I have a menu. You can tap everywhere to start playing. In the same screen I have UI button, but when i click it unity thinks I tapped to start playing , while in reality I wanted to click UI button!
Is there a clean solution , how I could block tap everywhere functionality when I click on UI buttons ?


Green : for tap everywhere I use just a simple Input.PressKeyDown()

Red : UI buttons I want “tap everywhere to play” functionality to not work

You can put a full transparent image(or button) under all UI elements, and make it fill up canvas.

This image can be clicked but won’t be triggered if you click other ui elements, then just add some events to this “dummy image”.

Notice: this image must be first child(first layer when render), or it would block others