Stuck trying to change the position of my Main Camera through scripting

Hi, I have a variable that when it changes, I want the position of my camera to update to the new position. But… its not changing. My debug’s show that its not the variable that is the problem, the variable is updating correctly, but the camera is not moving. Please help!

//Camera locations per room
	private Vector3 bathroomView = new Vector3(-0.5f, -1f, -24.5f);
	private Vector3 kitchenView = new Vector3(97.5f, -1f, -24.5f);
	private Vector3 bedroomView = new Vector3(195.5f, -1f, -24.5f);
	
	//Reference for the position of the camera which will be moved
	Vector3 mainCam;
	
	// Use this for initialization
	void Start () 
	{
		guiObject = GameObject.Find("GUI");
		drawGui = guiObject.GetComponent<DrawRoomGUI>();
		
		mainCam = GameObject.Find("Main Camera").transform.position;
	}
	
	// Update is called once per frame
	void Update () 
	{
		UpdateCameraToRoom(drawGui.selectedRoom);
		print (drawGui.selectedRoom);
	}
	
	//This function moves the camera to the new room cube that we have selected
	void UpdateCameraToRoom(string selectedRoom)
	{
		//Switch what view the camera has depending on what room we have selected in the DrawRoomGUI
		switch(selectedRoom)
		{
		case "Bathroom":
			mainCam = bathroomView;
			break;
			
		case "Kitchen":
			mainCam = kitchenView;
			break;
			
		case "Bedroom":
			mainCam = bedroomView;
			break;
			
		default:
			mainCam = bathroomView;
			break;
		}
	}

you’re just swaping between the vectors you created but never changing the cameras position.

To set the position you need a reference to the camera, so in the Start function instead of getting the cameras position you get the camera itself:

Camera mainCam;
 
// Use this for initialization
void Start () 

{
   guiObject = GameObject.Find("GUI");
   drawGui = guiObject.GetComponent<DrawRoomGUI>();
 
   mainCam = Camera.mainCamera; // Grab a reference to the camera
}

Then in you switch statement you can go:

mainCam.transform.position = kitchenView;