Answer the question
In order to leave comments, you need to log in
There are sounds on the PC, when compiling for android, the sounds disappear and the button to turn them on is not pressed at all, how can I fix it?
There are sounds on the PC, when compiling for android, the sounds disappear and the button to turn them on is not pressed at all.
Here is the button script:
public void MusicWork(){
if(PlayerPrefs.GetString("music") == "No" && gameObject.name == "Music") {
GetComponent<AudioSource>().Play();
PlayerPrefs.SetString("music", "Yes");
GetComponent<Image>().sprite = musicOn;
}
else if(PlayerPrefs.GetString("music") == "Yes" && gameObject.name == "Music"){
PlayerPrefs.SetString("music", "No");
GetComponent<Image>().sprite = musicOff;
}
}
if (PlayerPrefs.GetString("music") == "Yes")
GetComponent<AudioSource>().Play();
if (PlayerPrefs.GetString("music") == "Yes")
Answer the question
In order to leave comments, you need to log in
It helped me to insert PlayerPrefs.Save() at the end of the button code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question