Switch to second camera which has all the GUI

At this point I can only switch GUI on or off for all cameras. How would I switch certain "GUI.BeginGroup"'s on or off depending on whether I am using, in my case: 'Main Camera' and 'Gun Camera'?

Like so:

var camera1 : Camera; var camera2 : Camera;

function OnTriggerEnter(whatObject:Collider) { if(whatObject.gameObject.tag == "Player") {

    //~ Application.LoadLevel("invent");
    camera1.camera.enabled = false;

    camera2.camera.enabled = true;

    }

}

Thx in advance

You could just program scripts which draw the GUI on the screen. For example, just make each Group a function. Then in your OnGUI of the camera, call the correct method.

createGunGUI() { // Your code here renderGroupOne(); renderGroupTwo(); }

renderGroupOne() { }

renderGroupTwo() { }

Actually the script above works, if anyone wants to use it. My problem was an influence from another camera, here it is again:

var camera1 : Camera; var camera2 : Camera;

function OnTriggerEnter(whatObject:Collider) { if(whatObject.gameObject.tag == "Player") {

    //~ Application.LoadLevel("invent");
    camera1.enabled = false;

    camera2.enabled = true;

    }

}

I would just say inside your OnGUI function say:

function OnGUI(){

    if(camera1.camera.enabled = true){

        //Do GUI stuff that you only want to show on camera1 here

    }

}