I have 3 cameras in a practice scene that I want to switch between. Currently, I have a meshless cube acting as a trigger with the following script
public class CameraSwitch : MonoBehaviour
{
[SerializeField]
private GameObject startCamera;
[SerializeField]
private GameObject camera2;
// Start is called before the first frame update
private void OnTriggerEnter(Collider other)
{
if(other.tag == "Player")
{
startCamera.SetActive(false);
camera2.SetActive(true);
}
}
}
It's switching from the first camera to the second no problem, but it won't switch back if I move my player through the trigger again.
Is there a way I can store multiple different cameras inside one object and just disable every camera besides the one being used so I don't have to keep making triggers?
Any advice is appreciated.