UnityWebRequest HTTP get 请求

public class WebRequestSkipCert : CertificateHandler
{
   protected override bool ValidateCertificate(byte[] certificateData)
   {
      return true;
   }
}

string url = xxx;
UnityWebRequest unityWebRequest = UnityWebRequest.Get(url);
unityWebRequest.timeout = 10;
unityWebRequest.certificateHandler = new WebRequestSkipCert();
await unityWebRequest.SendWebRequest();
if (!string.IsNullOrEmpty(unityWebRequest.error))
{
   ShowErrorPanel(LoadingLanguageHelper.GetLang("Get_CDN_Config_Failed",GetLoadingLanguage()));
   return false;
}
var enterConfigJObject = JsonConvert.DeserializeObject(unityWebRequest.downloadHandler.text);
string configFileName = enterConfigJObject.ContainsKey(CurrentAppVersion)
   ? enterConfigJObject[CurrentAppVersion].Value()
   : enterConfigJObject["default"].Value();

你可能感兴趣的:(unity)