UnityWebRequests 可以像其他任何对象一样实例化。有两种构造函数可用
还有其他多个属性可用于设置、跟踪状态和检查结果或 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 provided
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