How to stop Audio

function Update ()
{
if (Input.GetKeyDown (“w”))
{
audio.Play ();
}
else (Input.GetKeyUp (“w”))
{
audio.Stop ();
}
}

I know its messed up at the Stop. I need to know how to make it to where when I release “w” the audio stops. Right now when I press “w” and release it the sound continues.

1 Answer

1

else if(Input.GetKeyUp (“w”))

otherwise this should work

yep, missing an if =]

–