Hello, I have added a background tune to my “menu” gameobject from the inspector and got it playing on awake — it works well in runtime, no problem here
I have then implemented a button for pausing music and change the button sprite — it works well, both the music pauses and the sprite changes as requested.
Now the problem: If I click the button to play music again, the sprite changes as expected but the background tune doesn’t resume playing. What am I doing wrong? I’ve had a look at many similar topics but can’t solve my problem yet.
Thanks in advance for your help.
//Called when the player presses the audio button
public void AudioToggle()
{
//If the audio button has the disabled sprite change it to the active one
if (audioButton.sprite == audioButtonTextures[0])
{
audioButton.sprite = audioButtonTextures[1];
audio.Play();
}
//Else, change it to the inactive one
else
audioButton.sprite = audioButtonTextures[0];
if (audio.isPlaying)
{audio.Pause();}
}