I’m making a pause menu, And i’m using what everybody recommends… the Time.timeScale = 0… and an overlay with GUIBox. It is working fine, but if I click one of the elements of the game in the background (which has a “onMouseDown” function) That function executes. And I’m clicking it over the overlay.
What Can I do to disable that function?.. Or to avoid that?
Check if the game is paused in your OnMouseDown function. A static variable may help here.
Put a collider across the entire screen just in front of the camera to block clicks
Upgrade to 4.6 and use the event system instead of OnMouseDown. Add a UI panel that covers the entire screen behind your pause menu. This will block clicks.
Try by making a transparent canvas of the size of the fullscreen and place it between your main game and the menu. The Canvas should make your objects unclickables.