I’ve tried with the WWW class but it doesn’t seems to work inside the editor, also i don’t know how to get the results back as it looks like I can’t run coroutine in the editor and yield the WWW request (can I?)
The request is fired from a button in a CustomEditor script.
as I said WWW in the editor doesn’t work… or anyway i can’t wait for the request to finish and get the result as i can’t start a coroutine in the editor as far as i know (i hope i’m wrong)
I’ve already had a crossdomain in the root of my domain, any way to use the System.Net?
is it not possible at all to do an http request in editor?
EDIT:
ok it was my fault, the WWW is working in the editor.
how can i know when the request it’s done and use the results?
can i use something like a coroutine/WaitForSeconds in editor?
I don’t want to do something like
request = new WWW(url);
while (!request.isDone){}
// use request.text here
because it will block the editor and i could have to execute several requests all at the same time
Waiting for the result is normally done by using the WWW in a coroutine and then use yield wwwObject (or while (!wwwObject.isDone) yield return null; )
once thats through, look if it had an error (wwwObject.error) and otherwise use it
You can’t use HTTPWebRequest on all Platforms, but you can use TCPClient and manually build your headers. We’ve slowly swapped over almost entirely to that (except for AssetBundles), due to some shortcomings of WWW.
In what form limiting? (I know it has limits but its targeted at what unity is, a game engine, not a general software platform so many of the limits are non impacting normally)
even if I switch the platform the WWW request will still look for a crossdomain.xml
my file is in the server’s root folder but i keep getting a “was not found” error, if I set the editor setting to the same domain everything works fine but the domain for the WWW request is dynamic so i can’t keep changing manually the security emulation setting in the editor.
I’m doing requests with the url in the form “https://username:password@domain” and as I said everything works fine apart from the access to the crossdomain.xml file, maybe when the API try to access it it will fail without the authentication?
Hmm that sounds more like a bug that it asks for it on other platforms as it is webplayer related.
And there it will always ask for it you can’t get around it, WWW is actually the only way to even get away with crossdomain.xml, TCP / UDP not only requires crossdomain.xml but a socket server to be running on the other end, port 843 default or anything else otherwise - this is the same as for flash and silverlight too for example
Dreamora, personally our limitations were primarily: GET requests with headers and content, and being able to process data from the stream rather than getting a completely downloaded block, we were downloading updates on iOS, and needed to both minimize network requests (more requests means more time spent in latency, or hitting the DOS protection trigger on the server with too many simultaneous requests), and unzip/process the data as it came in so we didn’t get Memory issues.
Also we needed a special case of Blocking Request (WWW can do this on iOS, but not in Editor which was annoying).