public bool OnOff;
public Sprite MusicOn;
public Sprite MusicOff;
private Image TempImage;
private void Start()
{
OnOff = true;
}
public void ToggleMusic()
{
if (!OnOff)
{
AudioListener.volume = 1f;
OnOff = true;
TempImage.sprite = MusicOn;
} else if (OnOff)
{
AudioListener.volume = 0f;
OnOff = false;
TempImage.sprite = MusicOff;
}
}
/