Hi guys,
I'm currently trying to implement audio in my game. My framerate drops significantly when I'm trying to play even one sound effect, not to mention background music.
For example:
If I collect an item a sound should play:
function OnTriggerEnter (collision : Collider)
{
if (collision.gameObject.tag == "Player")
{
audio.Play();
}
}
The GameObject which has this script attached has also an audio Source with a 1-2 second audio file.
If the sound plays there is a noticable loading time the first time the sound is loaded. On top of that the framerate drops every other time. Now it sometimes happens that a player collects 2 items in arow, and 2 sounds have to be played. Now it gets really messy. The framerate drop is really big and keeps on untill one of the two sounds stops.
Is there a better way to implement audio, without sacrificing so much performance or do I have to compress the mp3 (or should I use WAV) even more
I'm working with an iPhone 4.
Really appreciate any help.