Skip to main content
Up and Coming
October 21, 2015

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
    This topic has been closed for replies.

    4 replies

    Inspiring
    October 21, 2015
    Is it possible to load asynchronously?
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
    October 22, 2015
    Are you using yield return www? If you are, that's what's blocking the main thread while your audio/image loads.
    Up and Coming
    October 22, 2015
    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
    Check out my Unity VR development blog: http://talesfromtherift.com @peterept
    philedayAuthor
    Up and Coming
    October 23, 2015
    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