about OnTriggerEnter

i have this object that uses OnTriggerEnter/Exit functions to determine is something collided with it, i am turning it on/off, so the problem is when i have the situation when i turn on the object and it does not catch the objects that are already colliding with it but only ones that collides from that point… so how to get objects that are already collided with the object
when i turn trigger on?

thanks!

Keep the trigger active, but early exit it’s functionality when you need to instead of disabling the trigger. That way you can use enter/exit to populate an array of current objects.

how do yo mean early exit? i do not follow

var isTriggerActive = false;

function OnTriggerEnter() {

// Add object to array

if !(isTriggerActive)
 return;

// Do something

}

function ReactivateMyTrigger() {

isTriggerActive = true;

// Loop through array and do something to the objects

}