Inheritance: UnityEngine.MonoBehaviour
Esempio n. 1
0
		public static AudioHelper Get() //This makes it so we can remotely access this script from anywhere in the scene.
		{
			if( !audio ) //Check if we already have an instance of this script in the scene, if so just return it.
			{
				audio = GameObject.FindObjectOfType< AudioHelper >(); //Find this script in the scene.
				if( !audio ) //Make sure we found something.
				{
					//Make a new object and attach this script to it. 
					GameObject newObj = new GameObject("=== Audio Helper ===");
					audio = newObj.AddComponent< AudioHelper >();
				}
			}
			return audio;
		}