- Home /
Machine gun sound — better to loop individual bullets or have a longer sample?
For a rapid-fire assault rifle, is it better performance-wise to have a 'single bullet' sound for every bullet it fires, or to have a long, 1-2 second sample, which is played or stopped depending on when the player is firing the gun?
I'm currently using a short bullet that is "playClipAtPoint" but I'm concerned of the strain (if any) that creating all these sounds may be putting on Unity. But on the other hand, increasing the sample size would eat memory. Anyone happen to know the better approach?
Personally i would have a few different bullet sounds(maybe 3 or 4, and 2 ricochet sounds for collisions with buildings). Put the 3-4 different sounds in an array and randomly choose 1 sound to play when shot or cycle through the array. I think this will be more efficient and easier to manage than 1 long sample of sounds.
For sound effects like these, make sure that you select it to 'Decompress on Load,' that way you're $$anonymous$$imizing any strain if at all any that Unity has on the device it's running on. You'll really only be able to see performance dips when you're accessing the same clip with 'Compressed in $$anonymous$$emory' because every time you call it, it will have to decompress and then play. That will most definitely cause a jump in performance overhead.
Your answer
Follow this Question
Related Questions
How to add sound to gun shot script 4 Answers
hey here wesley again sound for my gun 1 Answer
gun fire sound 2 Answers
Automatic gun sound freaking out 4 Answers