Hi
I have a simple gun animation that plays when it is fired. I have tried to attach a sound to it but it doesn't want to play. I thought the code below would make the sound play when I fired, but it doesn't!
EDIT : I have sorted it out, however I only want the audio to play once, and then not be able to play again until the animation is finished. How would I do this?
var rifle : AudioClip;
function Update () {
if (Input.GetButton("Fire1")) {
animation.Play("AnimationEnfield");
audio.PlayOneShot(rifle);
}
}