Alternative to WWW ?

I did a lot of digging but didn’t find much that helped directly.

I am trying to load web based WAV files asynchronously because every time I request a WAV file Unity hangs.

I tried using threading but the debugger tells me WWW can only be called in the main thread.

Is WWW the only way for Unity to communicate over the web ?

How about if I wrote a DLL to handle the http requests, would that be possible ?

Or are there other solutions please ?

Many thanks.

There are .NET classes to achieve this (I haven’t used any of them, but HttpWebRequest exists), but I think your bigger challenge will probably be to then get the WAV file imported as a Unity audio file.

Are you using your WWW object in a coroutine? I don’t think you need anything near a dedicated thread just to load some files asynchronously.

By the way, even when loading in another thread, you’ll need to use the unity thread to import the file into unity. So it’ll hang at that point without a coroutine.

1 Like

Thanks for the replies.

@StarManta , thanks that might be useful for other things.

@atrakeur Yes I just found a useful topic that helped. By using the coroutine like in this example I managed to eliminate the lag :slight_smile: