Main Menu Camera Changer Script

I haven’t found one myself and also had to make one myself, all from my own (Beginner) knowledge. but here it is,
A brief description for it is once a 3d text is selected, it changes to the camera set to the checked box of where it will switch to.

//These are the buttons checked in the inspector on the 3d text your going to click to change into
var isMenuButton = false;
var isEquiptmentButton = false;
var isOptionsButton = false;
var isServerButton = false;
var isSoloButton = false;
var isQuitButton = false;
//Cameras switched to will go here
var isMainCamera : GameObject;
var EquiptmentCamera : GameObject;
var OptionsCamera : GameObject;
var ServerCamera : GameObject;

//Make sure the main camera is on isMainCamera or it will start with another
isMainCamera.active = true;
EquiptmentCamera.active = false;
OptionsCamera.active = false;
ServerCamera.active = false;

//Feel free to change the color of it selected.
//its the red below, switch it to green or blue or anything
function OnMouseEnter()
{
renderer.material.color = Color.red;
}

//This will change back to original color white
function OnMouseExit()
{
renderer.material.color = Color.white;
}

function OnMouseUp()
{
if( isMenuButton )
{
isMainCamera.active = true;
EquiptmentCamera.active = false;
OptionsCamera.active = false;
ServerCamera.active = false;
}

if( isEquiptmentButton )
{
isMainCamera.active = false;
EquiptmentCamera.active = true;
OptionsCamera.active = false;
ServerCamera.active = false;
}

if( isOptionsButton )
{
isMainCamera.active = false;
EquiptmentCamera.active = false;
OptionsCamera.active = true;
ServerCamera.active = false;
}

if( isServerButton )
{
isMainCamera.active = false;
EquiptmentCamera.active = false;
OptionsCamera.active = false;
ServerCamera.active = true;
}
}

Anyways I hope this helps anyone on the way :slight_smile:

Welcome to the Forum

You should look into gameObject.SetActiveRecursively(true); to cut your code down to a few lines.