void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; DontDestroyOnLoad(gameObject); soundSource = gameObject.AddComponent<AudioSource>(); soundSource.loop = true; soundSource.volume = volume; soundSource.clip = sound; soundSource.Play(); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; DontDestroyOnLoad(gameObject); soundSource = gameObject.AddComponent <AudioSource>(); soundSource.loop = true; soundSource.volume = volume; soundSource.clip = sound; soundSource.Play(); } }