# Unity Sound effect playing too many times

In the class PlayerControl I have this

if (Input.GetKey("space"))
{
soundManager.PlayBleep();
sword.SetActive(true);
}


In my soundmanager I have this

   public void PlayBleep()
{
if (!audio.isPlaying) {
audio.PlayOneShot(SwordWhip2);
}
}


At the moment I am getting the sound like 10 times each time I press space creating horrible soundeffects. How could I get it not to play until the sound has finished?

PlayOneShot does not alter isPlaying. See here. So isPlaying will always be false.
A simple fix is to change your input to only trigger once. Instead of Input.GetKey("space") you can use Input.GetKeyDown("space").