private static void Init() { // Unity replaces a destroyed game object with a non-null "destroyed" object. // Using .Equals checks against that. if (instance == null || instance.Equals(null)) { GameObject gameObject = new GameObject("Spawned AudioManager"); instance = gameObject.AddComponent <AudioManager>(); DontDestroyOnLoad(gameObject); Debug.LogFormat("Spawned new {0} singleton", typeof(AudioManager)); } }