So I’m trying to make a sidescroller in Unity using 2D. I want my character to make a sound when he jumps. But if I press the jump button again in the air the sound will play but hes not jumping, I don’t want this.
Here’s my code…
#pragma strict
var jump : AudioClip;
function Update () {
if(Input.GetButtonDown("Jump")){
if(!audio.isPlaying){
audio.Play();
}
}
}