I'm trying to make a script that lets me switch from one camera to another but I keep getting the same error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Switch : MonoBehaviour {
GameObject Camera1;
GameObject Camera2;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown("1"))
{
Camera1.SetActive(true);
Camera2.SetActive(false);
}
if (Input.GetKeyDown("2"))
{
Camera1.SetActive(false);
Camera2.SetActive(true);
}
}
}
↧