- Home /
Question by
Pure Phase · May 01, 2010 at 06:28 PM ·
animationaudiofire
Why wont my fire audio work?
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);
}
}
Comment
Your answer
Follow this Question
Related Questions
How to select an animation clip by index number? 7 Answers
Animation Events taking a Component Reference 1 Answer
iOS audio video sync problem 0 Answers
How to stop Input? 1 Answer
How to implement voice acting? 1 Answer