Hi guys,
I’ve been tasked with porting one of our apps from Unity 5.6.0 to Unity 2017.3.0.
This app runs on the following platforms:
- Windows Standalone
- Windows Universal Store App
- iOS
- and Android
So far, the Windows Standalone version works fine.
The problems start with the Windows Univeral Store App version:
With this platform I don’t seem to be able to make any kind of http or https request.
Previously when using Unity 5.6.0 we used the www class to make these requests. Here is a code snippet of the original code:
if (Application.internetReachability != NetworkReachability.NotReachable)
{
// Construct header and append the encrypted XML string to the headers byte array.
byte[] aRequest = AppendHeader(strXMLRequest);
WWW cWWW = new WWW(m_strURL, aRequest);
while (!cWWW.isDone)
yield return null;
try
{
m_strXMLResponse = cWWW.text;
}
catch
{
Debug.LogError("Download error!");
m_strXMLResponse = "";
}
}
This code no longer works under Windows Universal platform. cWWW.text
is always empty.
Now I realize that the WWW
class is deprecated, so I decided to rewrite the code so it uses the UnityWebRequest
class.
Here is another short code snippet:
UnityWebRequest uwr = UnityWebRequest.Post(m_strURL,"");
yield return uwr.SendWebRequest();
if(uwr.isNetworkError)
{
Debug.Log("Error While sending: " + uwr.error);
}
else
{
Debug.Log("Received: " + uwr.downloadHandler.text);
}
However with this code uwr.isNetworkError
is always true
and uwr.error
is always set to: “Generic/unknown http error.”
This is the case for any kind of http or https url. So at the moment ist seems I can not perform any kind of http or https request using unity classes in Unity version 2017.3.0.
I downloaded Unity 5.6.0 again just to make sure it wasn’t something to do with my computer or maybe some new settings that the sys admins made to the company firewall.
- the code worked fine.
Going back in Unity versions I could see that the code works up unitl Unity version 2017.2.1. So it would seem this is some kind of bug or regression within Unity 2017.3.0.
I’ve tried all the patch versions of Unity 2017.3.0 and the 2018 Beta version and the problem persists in all these versions.
Could someone please confirm if this is really an unintended bug and if there is some kind of workaround?
If it is a Unity bug I would say this is very critical.
Any help or feedback would be greatly appreciated.
Cheers…