Question by
Grossen · Nov 28, 2015 at 03:18 PM ·
audiosourcemute
Problems with audio muting
Hello!
I've got a problem when it comes to playing a sound (global) during all my scenes. I got the audio to play thourghout all the scenes but the problem is the "mute" button I added. If i mute the sound in the first scene, then change to another scene, i'm unable to awake the audio again. The object that make sure that audio is playing all the time is missing when i'm returning.
I use this script in order to play the audioclip during all the scenes:
public class aduio : MonoBehaviour {
public static audio Instance { get; private set; }
private void Awake() {
if (Instance != null) {
DestroyImmediate(gameObject);
return;
}
Instance = this;
DontDestroyOnLoad(gameObject);
}
Any suggestions?
Comment