Using input.getbuttondown to play audio = NOT WORKING? :(

I’m having the hardest time figuring out what’s wrong here. When I press mouse 0 (which I set as “Attack1” in Input) I want it to play my attack sound. I’ve given my character an audio source, and I’ve given him this script:


var sound : AudioClip;

function Update (){

if(Input.GetButtonDown("Attack1")){
    audio.Play();
}

}


I’ve also dragged the corresponding audio file to the target slot in the inspector.

I don’t know why this isn’t playing :frowning: I’ve checked the sound to make sure it even played anything, and it does. All the names are correct and all the capitals are in the right spot.

I know very little about scripts but I’ve done a lot of research and from the looks of things, this ought to do it?

What am I missing?

I did. :frowning:

fafase! You are a genius. That worked… but why would that make any difference? :confused:

Thank you so much!