OnTriggerExit and deactivating Colliders

I have triggerPlattforms and simple events like:

void OnTriggerEnter(){
    Debug.Log("Set Plattform triggered");
}

void OnTriggerExit(){
    Debug.Log("Set Plattform untriggered");
}

And than I have grabbable Objects. The moment I grab them I disable their Colliders using

Collider[] colliders = GetComponentsInChilds<Collider>();
foreach(Collider childCollider in colliders){
    childCollider.enable = false;
}

But this leads to the following problem:
When I drop an object on the Plattform, everything works fine and it becomes triggered.
But when I grab the object again, the Colliders get disabled => OnTriggerExit is never called because there are no Colliders enabled which could call the event.

Is there any way to let an Object check if there is currently no Collider in it?


Alternatively:

In wich order are Update() and OnTriggerEnter()/OnTriggerStay executed?

I guess a workaround could be to set the Plattform always to untriggered within Update() and use OnTriggerStay. But ofcourse this only makes sence if OnTriggerEnter()/OnTriggerStay() is executed after Update()

Note:

I have also read this but it doesn’t help since my problem is that OnTriggerExit is never called after disabling Colliders.

You could try using a boolean “triggered” on the objects you’re picking up which is made true by OnTriggerEnter and false by OnTriggerExit, and using if (triggered = false) with your collider disabling script? So in theory the collider only gets disabled once it has called OnTriggerExit.

I managed to hack arround it.

The Answer to the second question is: Update() is executed before all physics based methods (including OnTriggerEnter, OnTriggerStay, OnTriggerExit)

So I’m now storing the last object which triggered the plattform and checking if the bounds still overlapp within Update:

private GameObject _lastTriggerObject;

private void Update()
{
    if(_lastTriggerObject == null) return;

    Collider[] objectColliders = _lastTriggerObject.GetComponentsInChildren<Collider>(true);

    foreach (Collider objectCollider in objectColliders)
    {
        if (_collider.bounds.Intersects(objectCollider.bounds))
        {
            foreach (Collider col in objectColliders)
            {
                col.enabled = false;
            }
            return;
        }

        foreach (Collider childCollider in _childColliders)
        {
            if (childCollider.bounds.Intersects(objectCollider.bounds))
            {
                foreach (Collider col in objectColliders)
                {
                    col.enabled = false;
                }
                return;
            }
         }
     }

    //This is only reached if no Colliders where found
    Debug.Log("Disabled plattform after object left");
}

private void OnTriggerEnter(Collider col)
{
    _lastTriggerObject = col.gameObject;

    Debug.Log("Trigger Plattform");
 }

private void OnTriggerStay(Collider col)
{
    _lastTriggerObject = col.gameObject;

    Debug.Log("Trigger Plattform");
 }

    
 private void OnTriggerExit(Collider col)
 {
     Debug.Log("Untrigger Plattform")
     _lastTriggerObject = null;
 }

Anyway this leaded to another problem as you can see because all the Colliders seem to be re-enabled by doing this.

So additionally I had to disable them all again.

This is truely not a perfect solution and not very efficient but only a workarround for now.