Render only one room instead of all.

Here are 2 pictures of my current setup.

http://goo.gl/aSgsI ← outside

http://goo.gl/NxFpd ← inside

Currently I have a box collider set to trigger on each building and tagged as “Interior”. Then when the player enters an “Interior” trigger I swap the layers that the camera renders. All the Interiors are on one layer and the outside world on another.

Now I want to be able to render only the interior that I am in. rather than all. Using layers is not particularly feasible as there is a limit to those.

I wish to avoid teleporting the player to a different location.

Any suggestions? Thankyou

I did try to search this but was finding to think of keywords to search for.

A way I think you could do it is by storing all the gameobjects for each interior in an array , then have it so the box collider stores which house it is attached to and it disables the renderers on all the other gameobjects in the array. This will work, it just takes time to setup.

Main script with all interiors:

GameObject[] interior = new GameObject[10];

void Start()
{

for(int i =0; i < interior.Length;i++){

interior*.renderer.enabled=false;* 

}

}
and another script attached to the collider :

GameObject attached; // Interior mesh.

void OnTriggerEnter() {

attached.renderer.enabled=true;

}

void OnTriggerExit(){

attached.renderer.enabled=false;

}
The idea of this is to disable all renderers for interiors on startup and then enable them when the player enters the house and disable again when they leave it.