Hello guys !
Today I am asking you how to make a gun playing a sound when I click on “mouse0” ?
I would like to know everything to do, even if there is other stuff that scripting to do, because i tried but i always have errors ! Please help me !
Hello guys !
Today I am asking you how to make a gun playing a sound when I click on “mouse0” ?
I would like to know everything to do, even if there is other stuff that scripting to do, because i tried but i always have errors ! Please help me !
Don’t you have an open thread regarding this already?
It’s simple.
public AudioClip gunSound;
void Update(){
if(Input.GetMouseButton(0)) {
audio.PlayOneShot(gunSound);
//call your shooting function, or just place the audio.PlayOneShot in your shooting function.
}
}
What you are asking is really basic stuff, I’d suggest doing a few weeks worth of tutorials to get a better idea of how to script and use Unity.
Check out www.unity3dstudent.com