Is there any way to make event like If(trigger is empty)…?
In my situation, in trigger could be more that 20 objects, that entering & leaving my trigger randomly. So when trigger is absolutely not triggering any objects - is empty, it’s turning in to a collider.
Maybe also checking that every 2 seconds.
The function OnTriggerStay detects colliders inside the triggers.
In the OnTriggerStay function, you could do a ++counter.
Then, you have a seperate coroutine, which checks the counter every x seconds, whereafter placing it back to 0. (this coroutine should also keep looping)
That way you can count the objects that are in your trigger.
Let me know if it works
I have been using an OverlapSphere in my game warscape alpha for error checking in these cases and it works well (network players leaving server in middle of automatic doors leaves the doors broken and the trigger count useless).
Just check the returned collider arrays length for zero (use a LayerMask too). you could invoke this function every few seconds.