- Home /
Gun Sound On Mousedown
I need a script that tells an audio to play when i click the mouse down. Ive looked everywhere and none really seem to work, if anyone can help that would be exelent.
Thanks in advance
Answer by Bunny83 · Apr 20, 2012 at 03:42 PM
You've looked everywhere? So you should have found AudioSource.Play and Input.GetMouseButtonDown.
No he hasn't, the answer I give below is from another answer I gave 5 days ago...http://answers.unity3d.com/questions/241123/using-inputgetbuttondown-to-play-audio-not-working.html. Since he just ask for the script I won't bother explaining it.
Answer by fafase · Apr 20, 2012 at 03:43 PM
var sound : AudioClip;
function Start(){
audio.clip = sound;
}
function Update (){
if(Input.GetButtonDown(0)){
audio.Play();
}
}
Your answer
Follow this Question
Related Questions
FPS Shoooting Problem 1 Answer
Help with reloading gun. 1 Answer
How can I make a gun automatic? 2 Answers
Bullet does not move forward 1 Answer
Invoke shoot delay problem. 3 Answers