Unity2021.3.4f1 uses WeRequest.Create to cause exception under Android

Log a bug:

Unity2021.3.4f1, using WeRequest.Create, using mono packaging, the Unity Editor and WIndows platform are normal, but an exception will be thrown on the Android platform.

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Net.WebRequestPrefixElement..ctor (System.String P, System.Type creatorType) [0x00018] in <3a0cdb6ab18d4d64a4156144c783ac1e>:0 
  at System.Net.WebRequest.PopulatePrefixList () [0x00040] in <3a0cdb6ab18d4d64a4156144c783ac1e>:0 
  at System.Net.WebRequest.get_PrefixList () [0x00022] in <3a0cdb6ab18d4d64a4156144c783ac1e>:0 
  at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) [0x0002e] in <3a0cdb6ab18d4d64a4156144c783ac1e>:0 
  at System.Net.WebRequest.Create (System.String requestUriString) [0x00014] in <3a0cdb6ab18d4d64a4156144c783ac1e>:0 

It’s so frustrating. Such an important network library can actually have bugs. Didn’t Unity itself detect it? . .
Solution: Use il2cpp packaging, or upgrade to a version above 2021.3.11f1
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_42562717/article/details/129745842