- Home /
Multiple PlayOneShot bug
Hi! I have this script attached to my main camera:
public class soundCamera : MonoBehaviour {
public AudioClip shot;
public AudioSource source;
public static void shotSound() {
source.PlayOneShot (shot);
}
}
When I need the "shot" sound to play, I can call shotSound() from another script:
soundCamera.shotSound()
It works great until I try to play a lot of sound in a row. Then it just stops playing the AudioClips. If I wait several seconds, it works again.
I want a lot of sound feedback in my game, so I'll have to fix this issue.
Thanks in advance!
I've noticed this has happened to me before when the audio file i was using was '.mp3' after converting them to an uncompressed format like '.wav' my issues went away.
$$anonymous$$aybe the audio buffer is getting full, errors out and just cancels the action?
$$anonymous$$y sounds are in mp3, I'm gonna try with wav, thanks :)
Answer by Souk21 · Mar 23, 2015 at 08:28 AM
I çhanged the compression to uncompressed, and it now works :)