Tag: Siren is not defined? (Stealth Tutorial)

So I downloaded the stealth tutorial and tried out the DoneStealth scene. Everything works fine, except the alarms. When I start the game, I get this error:
UnityException: Tag: Siren is not defined!
DoneLastPlayerSighting.Awake () (at Assets/Done/DoneScripts/GameControllerScripts/DoneLastPlayerSighting.cs:32)
The Alarms in the Game are not working.
This is the LastPLayersighting script:

using UnityEngine;
using System.Collections;

public class DoneLastPlayerSighting : MonoBehaviour
{
	public Vector3 position = new Vector3(1000f, 1000f, 1000f);         // The last global sighting of the player.
	public Vector3 resetPosition = new Vector3(1000f, 1000f, 1000f);    // The default position if the player is not in sight.
	public float lightHighIntensity = 0.25f;                            // The directional light's intensity when the alarms are off.
	public float lightLowIntensity = 0f;                                // The directional light's intensity when the alarms are on.
	public float fadeSpeed = 7f;                                        // How fast the light fades between low and high intensity.
	public float musicFadeSpeed = 1f;                                   // The speed at which the 
	
	
	private AlarmLight alarm;                                           // Reference to the AlarmLight script.
	private Light mainLight;                                            // Reference to the main light.
	private AudioSource panicAudio;                                     // Reference to the AudioSource of the panic msuic.
	private AudioSource[] sirens;                                       // Reference to the AudioSources of the megaphones.
	
	
	void Awake ()
	{
		// Setup the reference to the alarm light.
		alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent<AlarmLight>();
		
		// 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);
		
		// Set the sirens array to have the same number of elements as there are gameobjects.
		sirens = new AudioSource[sirenGameObjects.Length];
		
		// For all the sirens allocate the audio source of the gameobjects.
		for(int i = 0; i < sirens.Length; i++)
		{
			sirens _= sirenGameObjects*.audio;*_

* }*
* }*

* void Update ()*
* {*
* // Switch the alarms and fade the music.*
* SwitchAlarms();*
* MusicFading();*
* }*

* void SwitchAlarms ()*
* {*
* // Set the alarm light to be on or off.*
* alarm.alarmOn = position != resetPosition;*

* // Create a new intensity.*
* float newIntensity;*

* // If the position is not the reset position…*
* if(position != resetPosition)*
* // … then set the new intensity to low.*
* newIntensity = lightLowIntensity;*
* else*
* // Otherwise set the new intensity to high.*
* newIntensity = lightHighIntensity;*

* // Fade the directional light’s intensity in or out.*
_ mainLight.intensity = Mathf.Lerp(mainLight.intensity, newIntensity, fadeSpeed * Time.deltaTime);_

* // For all of the sirens…*
* for(int i = 0; i < sirens.Length; i++)*
* {*
* // … if alarm is triggered and the audio isn’t playing, then play the audio.*
_ if(position != resetPosition && !sirens*.isPlaying)
sirens.Play();
// Otherwise if the alarm isn’t triggered, stop the audio.
else if(position == resetPosition)
sirens.Stop();
}
}*_

* void MusicFading ()*
* {*
* // If the alarm is not being triggered…*
* if(position != resetPosition)*
* {*
* // … fade out the normal music…*
_ audio.volume = Mathf.Lerp(audio.volume, 0f, musicFadeSpeed * Time.deltaTime);_

* // … and fade in the panic music.*
_ panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0.8f, musicFadeSpeed * Time.deltaTime);
* }
else*

* {
// Otherwise fade in the normal music and fade out the panic music.
audio.volume = Mathf.Lerp(audio.volume, 0.8f, musicFadeSpeed * Time.deltaTime);
panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0f, musicFadeSpeed * Time.deltaTime);
}
}
}*

And here’s the tags script:
using UnityEngine;
using System.Collections;_

public class DoneTags : MonoBehaviour
{
* // A list of tag strings.*
* public const string player = “Player”;*
* public const string alarm = “AlarmLight”;*
* public const string siren = “Siren”;*
public const string gameController = “GameController”;
* public const string mainLight = “MainLight”;*
* public const string fader = “Fader”;*
* public const string enemy = “Enemy”;*

}
Whats the problem?

Is it possible that you just copied the content of the sample project into a new project? That means all project settings are set to default. Specifically in the TagManager there are no tags defined. Go to Edit → Project Settings → Tags and Layers and see if the “Siren” tag is defined in the tags array. If not you should add that tag.

That might not be the only problem. I never looked at the sample projects, so i’m not familiar with them. There could be other tsgs or layers missing. In the Input manager there could be additional axes etc…

For anyone else that was stuck on this like I was, “DoneTags” should just be “Tags”.

using UnityEngine;
using System.Collections;

public class Tags : MonoBehaviour {

	public const string player = "Player";
	public const string alarm = "AlarmLight";
	public const string siren = "Siren";
	public const string gameController = "GameController";
	public const string mainLight = "MainLight";
	public const string fader = "Fader";
	public const string enemy = "Enemy";
	
}