Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Object reference not set to an instance of an object

$
0
0
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); } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>