using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Camera_Switch : MonoBehaviour
{
[SerializeField] public List<GameObject> num_Cameras = new List<GameObject>();
//Allows me to set the ammount of cameras I want from unity editor by making an array
//You need to set the object not the empty
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown("1"))
{
for (int x = 0; x < num_Cameras.Count; x++)
{
num_Cameras[x].GetComponent<Camera>().enabled = false;
num_Cameras[0].GetComponent<Camera>().enabled = true;
};
}
//Upon pushing the number 1 it sets all other cameras except for the one in element slot 0 to false
else if (Input.GetKeyDown("2"))
{
for (int x = 0; x < num_Cameras.Count; x++)
{
num_Cameras[x].GetComponent<Camera>().enabled = false;
num_Cameras[1].GetComponent<Camera>().enabled = true;
};
};
}
}