I want to check if the Input on the mouse button and if I am not clicking on a not clickable area. But I need to make a area as well, any suggestions on what I can do?
There are many ways to accept click/tap input, and each way requires a different way to block.
If it is just UI (such as a button or slider or what-have-you underneath a Canvas), you can:
disable it or otherwise set it inactive
set it not interactable (this may make it dim out, depending on configuration)
cover it with visible (or invisible) blocker(s) (Graphic object marked RaycastTarget)
If it is a function like Input.GetMouseButtonDown(0), that will ALWAYS register, no matter what, so now you need to alternately ask, where is the mouse and is it blocked or should I pay attention to this click.
Same goes for Input.touches, the array of touches on mobile. They will arrive; it’s up to you to decide not to respond.
As always, it’s helpful to break the steps down:
The underlying input system produces low-information “I clicked at this coordinate” data.
At some point your code decides “Hey, that click means X to my program!”
And then at some point you act upon that “X” and actually go and do the X.
Blocking can take place anywhere along the line, whatever is logically most convenient for you.