Symptoms
- I want to use WWW with a Proxy in players (runtime), but it does not work. (Not WebPlayer)
Cause
If you use WWW with a Proxy in players (runtime, not WebPlayer) it may fail.
Resolution
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:
using UnityEngine;
using System.Net;
public class MyWebProxy : MonoBehaviour
{
void NewClient()
{
string yourProxyServer = "yourproxyserver.com";// you can use "yourproxyserver.com:port"
WebClient client = new WebClient();
WebProxy proxy = new WebProxy(yourProxyServer);
// 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.
More Information