Following the tutorials from Unity but after the lecture 106 got this error in my LastPlayerSighting script file
NullReferenceException: Object reference not set to an instance of an object
LastPlayerSighting.Awake () (at Assets/Scripts/LastPlayerSighting.cs:29)
on panicAudio line
alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent();
// Setup the reference to the main directional light in the scene.
mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).light;
// Setup the reference to the additonal audio source.
panicAudio = transform.Find("secondaryMusic").audio;
// Find an array of the siren gameobjects.
GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);
Any Idea what's going on?
↧