Audio Clumping

hey once again,

Whenever I shoot pressing my on-screen button it plays the audio, but multiple times within a few seconds here is my code:

[1]


  [1]: http://pastebin.com/10B4V5gc

any help?

I think this section of code is running a few times, when you want it to run only once. Add a simple Print(“Shooting.”) line of code so you know how many times this conditional statement runs.

A possible solution is putting a small wait time between firing, like 1 second.

var shootWaitTime : float = 1.0;

if (shootTouchPad.tapCount >= 1 && Time.time >= nextShootTime)
{	
	nextShootTime = Time.time + shootWaitTime;
	RayShoot();
	PlayShootAudio();
    Print("Shooting."); //this is just to see how many times this conditional statement runs
}

Please tell me if this doesn’t work.

Good Luck.