I try to play a sound but it does not play
Here is my code:
public void Replay()
{
playAudio ();
Application.LoadLevel (Application.loadedLevel);
}
void playAudio()
{
AudioSource audio = GetComponent<AudioSource> ();
audio.Play();
}
When the button is pressed, I call Replay(). But the sound does not play.
If I noticed Application.LoadLevel (Application.loadedLevel);, the sound plays normally.
What should I do to make sound play with Application.LoadLevel()?
source
share