- Home /
UnityWebRequest blank error message on Hololens
Hello,
I'm trying to hit a REST API endpoint using UnityWebRequest on the Hololens. Works find locally, but fails on the Hololens. The isNetworkError flag is true, but the error message is an empty string. The endpoint is on the local network, requires no authentication and is reachable from the Hololens through the web browser. I'm using 2017.3.1f1. Code is below.
Any ideas of how to resolve or if there is a known good way of making HTTP calls from the Hololens?
public class WebExample : Singleton<WebAPIBridge>
{
public CycleReadout cycleReadout;
private IEnumerator GetCycleReadout()
{
string TargetURL = "http://192.168.86.78:9000/rpm_read";
UnityWebRequest webRequest = UnityWebRequest.Get(TargetURL);
yield return webRequest.SendWebRequest();
if (webRequest.isNetworkError)
{
string error = webRequest.error;
Debug.Log(error);
}
else
{
string data = System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data);
Debug.Log("Got data: " + data);
cycleReadout = JsonUtility.FromJson<CycleReadout>(data);
}
}
void Update()
{
if (Input.GetAxis("Fire1") > 0)
{
StartCoroutine(GetCycleReadout());
}
}
}
Ever find an answer to this? I have the same problem!
what status code are you getting from the response?
Your answer
![](https://koobas.hobune.stream/wayback/20220612160445im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
multiple webrequests, one exception causes next to time out, rest are fine 0 Answers
Error getting response stream (Write: The authentication or decryption has failed.): SendFailure 0 Answers
Android Download asset bundle locally 0 Answers
A method for streaming custom audio from the hard drive 0 Answers