Turning off the colliders of children objects.

Hey there, first post so correct me if I’m doing anything wrong.

At the moment I am trying to create a world where as the character walks through a doorway the room they came out of disappears.

At the moment I have been able to disable all the renderers of the children objects(They sit under the trigger object), but when I apply the same logic to the Colliders it doesn’t work (character still runs into wall).

May question is why?

function OnTriggerEnter(){

meshChildren = gameObject.GetComponentsInChildren.<MeshRenderer>();
for (var mesh : MeshRenderer in meshChildren) {
    if(mesh.gameObject!=gameObject) 
        mesh.enabled = false;
        
        //THIS PART WORKS
        
}

meshColChildren = gameObject.GetComponentsInChildren.<MeshCollider>();
for (var collider : MeshCollider in meshColChildren) {
    if(collider.gameObject!=gameObject) 
        collider.enabled = false;
        
        //THIS PART DOESN'T
        
}
}

As far as I can tell it should work

Many Thanks for any help

Object have different kinds of colliders: mesh, box, sphere. I’ll bet your walls have box colliders rather than mesh colliders. If so, to fix:

colChildren = gameObject.GetComponentsInChildren.<Collider>();
for (var collider : Collider in colChildren) {

Maybe it’s an old quesiton, but for me it worked best, when i removed the collider-component from all the child objects.