Inverse function of OnTriggerStay?

Hellow,

Like the title say, is there a function that is inverse to OnTriggerStay? I need to detect when the object is inside and when it's outside.

Or can I divide the function to tell it that when it's on True do "X thing" and when False do "Y thing"

Thanks.

No, there is no OnTriggerOutside or some such.

OnTriggerStay is called once per frame just as Update is. Using OnTriggerEnter and OnTriggerExit, you can achieve what you describe via a boolean flag:

var inside : boolean = false;

function OnTriggerEnter() {
    inside = true;
}

function OnTriggerExit() {
    inside = false;
}

function Update() {
    if(inside) DoX();
    else DoY();
}

it is not enough, not always, for exemple, in some circunstancy you miss the moment of “OnTriggerExit” for some complex reason such as parenting, the “stay” will be still confirmed. Actually if there is not the reverse effect, there is no reason for “OnTriggerStay”, it would be the same thing of OnTriggerEnter

If OnTriggerStay doesnt test for exit, there is no reason for exist, it is the same as OnTriggerEnter.