|
Post by discofever on Feb 22, 2016 20:11:43 GMT
Hi,
I'm having an issue with my game; it's a very fast paced shooter. Obviously my firing rate is pretty high.
When I instantiate the bullet, i play the SFX of the bullet by script : MasterAudio.PlaySound (SFXName); But it's very very laggish and i can't really change it.
What am I doing wrong here ? Is there a faster method ?
Thanks
|
|
|
Post by DarkTonic Dev on Feb 22, 2016 23:50:30 GMT
If you're playing an mp3 for a sound effect, that will make it slow. Also if you're using Resource files or "preload audio data" turned off, there will be latency as the clip must load before playing. If you're not doing any of those things, are you running on Android? Unity has latency problems on that platform in particular and there's nothing we can do about it.
And depending on what's on your bullet prefab, using Instantiate instead of pooling the object could be causing lag as well.
Note that you don't need to write code for this usage. Put an EventSounds script on the bullet and use Enabled event to play the Sound Group.
|
|