WebRequests可以像其他任何对象一样实例化。有可用的两种构造函数
还有其他多个属性可用于设置、跟踪状态和检查UnityWebRequest的结果或结果。
UnityWebRequest wr = new UnityWebRequest(); // Completely blank
UnityWebRequest wr2 = new UnityWebRequest("https://www.mysite.com"); // Target URL is set
// the following two are required to web requests to work
wr.url = "https://www.mysite.com";
wr.method = UnityWebRequest.kHttpVerbGET; // can be set to any custom method, common constants privided
wr.useHttpContinue = false;
wr.chunkedTransfer = false;
wr.redirectLimit = 0; // disable redirects
wr.timeout = 60; // don't make this small, web requests do take some time