Hi everyone!
I have a Canvas with two buttons (music on/music off) and i want to change and keep the change when reload the same scene. But how I do it ?
Here is my code.
public GameObject BtnOn;
public GameObject BtnOff;
public AudioSource BackGroundMusic;
public void SoundBtnOn()
{
if (BtnOn == true)
{
BackGroundMusic.Pause();
ClickBtn.Play();
BtnOn.SetActive(false);
BtnOff.SetActive(true);
Debug.Log("sound btnon");
}
}
public void SoundBtnOff()
{
if (BtnOff == true)
{
BackGroundMusic.Play();
ClickBtn.Play();
BtnOn.SetActive(true);
BtnOff.SetActive(false);
Debug.Log("sound btnof");
}
}
I tried use DontDestroyOnLoad but It doesn’t work.
want just that for me to finish my first game.
I would appreciate any help.