I want to play button click sound. At present when player click on play button, I write code for button click sound but in that I have written next scene loading code.
So I can’t able to play sound but if I comment my scene change code then it plays button click sound.
I have written following code for this purpose so guide me to make this correct.
public void OnInstructionButtonClick()
{
if (DataStorage.RetrieveSound() == Constants.PLAYERPREF_SOUND_ON)
{
persistentObject.GetComponent<SoundManager>().PlayClickSound();
}
Application.LoadLevel(Constants.INSTRUCTION_SCENE);
}
public void PlayClickSound()
{
AudioSource.PlayClipAtPoint(buttonClickClip, Vector3.zero);
}