- Home /
Will .Net WebRequest be available in Unity 3.0 web player?
We are testing using Unity for some online 3D content. We tried to use the WebRequest interface available in .Net but learned it's not available in .Net runtime in the Unity web player.
Since we need stream based access to the http reponse data (which the Unity WWW doesn't provide), we've implemented our own basic HTTP client code with .Net TcpClient and .Net Sockets.
Will the WebRequest (and WebProxy) interfaces be available for use in the Unity Web Player in version 3.0? In the past, it was mentioned it might be availble in a Unity version 2.7 (but I don't think that is going to exist).
cheers, Eric
Software Architect www.mixamo.com
I second that! It would be awesome to have more feature rich http-class than UnityEngine.WWW.
Answer by Lucas Meijer 1 · May 22, 2010 at 10:24 PM
There is no final decision on this yet. When you say HTTP response data, I assume that you mean HTTP response header data. I have added that as a feature to the builtin WWW class. Other than the hTTP response headers, is there anything else that WebConnection/WebRequest would offer you that our builtin WWW class does not?
Several 3rd party .NET assemblies, some are open source, have built in communication calls with server pages going over HTTP. They generally use web request in an async manner. Not having this class/object available in the web player leaves this sort of integration a mess, and really the only option is to hack up the open source with a custom version that somehow uses www, or try to build my own version or sub set of open source functionality for some of the things I'd like to do. If this class is available, like it is in stand along version, it works great. I like www, but please please add
Lucas, thanks for the follow up. Just to clarify my request...when I say "stream based access to the http reponse data" what I mean is literally have access to a System.IO.Stream instance which allows me to read HTTP response body byte by byte as it becomes available from the server (separate from the HTTP response headers). This is compared to the interface that WWW provides which is a byte array that is available ONLY after the response has been completely received by the client. (DUE TO SPACE CONSTRAINTS...CONTINUED BELOW...)
(CONT FRO$$anonymous$$ ABOVE) Providing access to the .Net/$$anonymous$$ono WebRequest would provide that functionality without having to complicate the existing WWW class API. Similiary, since we are experiencing severe stability issues using $$anonymous$$ono Sockets and Threads directly with our own HTTP client code as a work around to not having access to WebRequest, we are really hoping for an "offical" solution that doesn't crash $$anonymous$$ono/Unity. We have multiple case numbers about the crashes we are experiencing. With all that said, having access to HTTP headers in the WWW class is also a good idea. :)
WWW also doesn't support proxy traversal in Standalone builds, which is why we resorted to HttpWebRequest in 2.6. 3.0 appears to break on WebRequest.Create without even handling the exception.
Answer by qJake · Apr 10, 2010 at 03:06 AM
I'm not entirely sure if this will work in your case, but have you tried using System.Net.WebClient? I remember hearing from others that that is available in the Web player, but I don't know if it can suit your needs or not.
That would probably be me, but I have since learned that although the HttpWebRequest is available in the editor, it is not available in the webplayer. :(
Yeah, as your discovered, WebClient is based on WebRequest which is not available in the web player.
Your answer
![](https://koobas.hobune.stream/wayback/20220612154733im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I have multiple UnityWebRequests in one coroutine? 1 Answer
What is the equivalent of unityWebRequest.downloadHandler.text when using WWW? 0 Answers
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Draw on Image 0 Answers
Loading data from a different game 1 Answer