1. Home
  2. Knowledge Base
  3. Unity
  4. Using WWW With A Proxy (Unity)

Using WWW With A Proxy  (Unity)

  • I want to use WWW with a Proxy in players (runtime), but it does not work. (Not WebPlayer)
If you use WWW with a Proxy in players (runntime, not WebPlayer) it may fail.
WebPlayer takes the Proxy settings from the browser automatically. Other players (runtime) work differently and cannot use a Proxy. Therefore you can use this workaround with the WebClient and WebProxy classes and still use the Proxy:
string yourURL = "http://yourURL.com";
WebClient client = new WebClient();

WebProxy proxy = new WebProxy("yourproxyserver.com"); // you can use yourproxyserver.com:port
// check proxy.Credentials property and NetworkCredential class if you proxy uses user/password

client.Proxy = proxy;

With this code, you can use WebProxy.Credentials and the NetworkCredential class to set user/password info.


Was this article helpful?

Related Articles