Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
phileday's avatar
phileday
MHCP Member
10 years ago

Loading external audio and Oculus Tracking

In my project I have external audio being loaded from a hard drive location using the www feature of Unity. I didn't think this was too intensive but whenever it loads in the audio the Oculus screen freezes for a second. This also happens when loading in png's using the same method. Maybe this is just something that I have to live with but I wondered if anyone else had this issue or knows of any solutions to it. My project is a dynamically updated one so loading all the audio at the beginning isn't an option.

Any help would be gratefully received

Phil

4 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous
    Are you using yield return www? If you are, that's what's blocking the main thread while your audio/image loads.
  • For the audio, are you using a streaming audio source?

    For the textures - the www download is handled nicely with co-oroutines (so during download you're not going to freeze), but the actual load is intensive. You can use calls like Texture2D.LoadRawTextureData() which is much faster then ww.Texture - but it requires the image in a more specific format:

    http://docs.unity3d.com/ScriptReference ... eData.html
  • Thank you for your help. Looking at what you're saying I think I'm going to be looking at some pauses regardless of what I do. It's good to know that I'm not doing anything wrong though and that there isn't a straight forward solution that i'm missing.

    The Texture2D.LoadRawTextureData looks interesting but might mean that you can easily have bad file formatting that will break the input. I have got a yield in there which I'll play round with to see if that reduces it as much as possible. I don't think it's possible to load asynchronously unless anyone has advice on doing that.

    If I find any ways to significantly improve the issue I let you know.

    Thanks for your advice.

    Phil