Hello I want to play a sound on pause but it doesn’t work like I want. When I press P it pause but sound is not playing, and when I press R it sound but if it isn’t paused and you press R it sounds too.
I want that when you press P and pause play the sound and when you press R unpause and play the sound, and when is unpaused and press R that sound don’t play.
Here’s my code fragment of my code.
void update ()
{
if (Input.GetKeyDown (KeyCode.P))
{
Time.timeScale = 0;
EfectosDeSonido.Instancia.ReproducirSonidoPause ();
}
if (Input.GetKeyDown (KeyCode.R))
{
Time.timeScale = 1;
EfectosDeSonido.Instancia.ReproducirSonidoPause ();
}
}