Search Unity

UnityWebRequest does not work on HoloLens

Discussion in 'VR' started by MauriceGer, Aug 3, 2018.

  1. MauriceGer

    MauriceGer

    Joined:
    Apr 25, 2018
    Posts:
    3
    Hi, I want to download a txt-file from a Server. So here is my code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Networking;
    5. public class DownloaderScript : MonoBehaviour {
    6.    
    7.      public void GetFile()
    8.          {
    9.              StartCoroutine(Check());
    10.          }
    11.          private IEnumerator Check()
    12.          {
    13.              UnityWebRequest www = UnityWebRequest.Get("http://examplesite.com/example.txt");
    14.              yield return www.SendWebRequest();
    15.              if (www.error != null)
    16.              {
    17.                  Debug.Log(www.error);
    18.                
    19.              }
    20.              else
    21.              {
    22.                  Debug.Log(www.downloadHandler.text);
    23.                
    24.              }
    25.          
    26.          }
    27.      }
    It works perfectly on the Unity Editor, but not on the HoloLens Emulator and I dont get any error. "InternetClient" is activated in the PlayerSettings and I also tried to set www.chunkedTransfer = false. Did anyone had the same issue?
     
  2. MauriceGer

    MauriceGer

    Joined:
    Apr 25, 2018
    Posts:
    3
    Edit: I updated Unity and it worked. So it was a Bug.
     
  3. kwcae

    kwcae

    Joined:
    May 26, 2017
    Posts:
    34
    What version of unity were you running at the time of the bug and what version fixed it?