//This is to change the sprite when loading the menu based on the previous mute option void Start() { soundToggle = GetComponent <Toggle> (); muteMainSong = GameObject.FindGameObjectWithTag("MainSong"); muteMainSong.GetComponent <AudioSource> (); scriptSound = muteMainSong.GetComponent <MuteSound> (); if (scriptSound.toggleOn == true) { soundToggle.isOn = true; } else { soundToggle.isOn = false; } }
public void activateMuteFunction() { soundToggle = GetComponent <Toggle> (); //If there is no script currently attached to execute function if (muteMainSong == null) { muteMainSong = GameObject.FindGameObjectWithTag("MainSong"); muteMainSong.GetComponent <AudioSource> (); scriptSound = muteMainSong.GetComponent <MuteSound> (); scriptSound.muteSong(); } else { scriptSound = muteMainSong.GetComponent <MuteSound> (); scriptSound.muteSong(); } }