Contrary to "OnMouseDown()"?

I have a gameobject that activates its child when its clicked on (I get the click through OnMouseDown() method). I want that the same gameobject disables its child when the player clicks somewhere else (not over it). Is there any contrary function to OnMouseDown() to get that click? Or I have to use raycast to see if the player clicked on it or not?
I’m usingUnity 5

Yes, there are a lot more mouse functions, but I just don’t know them off the top of my head or however that saying goes.
I’m not a Professional at coding but you could do something like

void OnMouseDown()
         //enable your object
    void OnMouseExit()
     //which will happen whenever someone closes
     if(input.GetButtonDown("Fire 1")
                  //Anywhere that is not the object.

Hope I helped I’m still learning. But I’ll put a link right here:Unity - Scripting API: MonoBehaviour

All of the functions in Monobehavior which is the source for all functions in unity.

I guess a function like that would create a lot of overhead, calling an “OnMouseDownNotOverThisObject” on EVERY object (that’s not the one clicked) is a bit too much considering the click is a pretty common input method.

You probably need a “workaround”, like:

  1. The raycast you mentioned. Or…
  2. Use OnMouseEnter so set a bool to true, OnMouseExit to set it to false, check for mouse clicks on Update and instead of the raycast use the bool variable (if true, you clicked on the object).

I’m not sure if those can be called workarounds since I can see why something like that is not implemented as an event that’s send to every object.