【发布时间】:2022-10-07 09:58:33
【问题描述】:
下面的代码适用于编辑器和单声道构建,但不适用于 il2cpp 构建。
我发现了这个错误报告: https://fogbugz.unity3d.com/default.asp?1156595_buha3p1v4iq7vpv9
并注意到开发人员已决定不解决此问题。
那么,il2cpp 构建是否有任何解决方案。 谢谢
if (Settings.GetBool_AndIsTrue(\"useSystemProxy\"))
{
print(\"use System proxy\");
HttpClientHandler handler = new();
handler.Proxy = WebRequest.GetSystemWebProxy();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
| SecurityProtocolType.Tls
| (SecurityProtocolType)0x300 //Tls11 .net framework 4.0
| (SecurityProtocolType)0xC00; //Tls12 .net framework 4.0
httpClient = new HttpClient(handler);
}
httpClient.Timeout = new TimeSpan(0, 0, 0, 10);
string result = string.Empty;
//first try
try
{
result = httpClient.GetStringAsync(url).Result;
}
-
使用 Unity-equivalent 而不是这个白领依赖注入导向班级。它希望生活在单例世界中,这与 Unity 及其inability to detect DNS changes 有问题。
-
嗯,我改用 UnityWebRequest。现在看来还可以。谢谢
-
不用担心,
HttpClient很尴尬。 ;)
标签: unity3d