Web build client freezes when start playing a newly downloaded audio clip...
I downloaded music files in OGG format:
WWW www = new WWW();
Clip clip = www.GetAudioClip(false);
Then played them:
if (clip.loadState == AudioDataLoadState.Loaded)
{
audioSource.Stop();
audioSource.clip = clip;
audioSource.Play();
}
Everything works, but there is a noticeable client freeze if you have a weak PC, it lasts almost a second when clip plays first time... when I switch to other downloaded clips it freezes again, after first time it switches without freezes....
It's clear that it unpacks or converts audio when playing it first time, but can I change the priority on this to allow the game run smoothly?
Maybe different audio format can solve the problem? ... but in any case, audio file should be compressed, otherwise it will eat a lot of traffic.
↧