Search Unity

HTTP Get Request works in Unity Editor but not on Hololens

Discussion in 'AR' started by StefanBoehm, Sep 21, 2019.

  1. StefanBoehm

    StefanBoehm

    Joined:
    Aug 8, 2019
    Posts:
    3
    Hi,
    i use a get request to get data from a webservice. In the unity editor every thing works fine, but on hololens the request reaches the webservice but the data wont get to the hololens. Also the delay i implemented in the update method isnt working either. Bevor the approach with the get request i programmed an opc ua client in unity. There it was the same problem. In the editor every thing is working fine, but not on the hololens.
    I'm using:
    - unity 2018.4.6f1
    - visual studio 2017 community
    - skripting backend il2cpp, api level .NET4.x and .net 4.0
    - and as base programm i'm using the gaze tutorial programm from the hololens microsoft tutorial
    - player settings internetclient, internetclientserver, privatenetworkclientserver are activated

    Following my code:

    public float countdown = 3.0f;
    void Update()
    {
    countdown -= Time.deltaTime;
    if (countdown <= 0.0f)
    {
    GetInfo();
    currentWayPointText.text = info.CurrentWaypoint.ToString();
    xText.text = info.X.ToString();
    yText.text = info.Y.ToString();
    alphaText.text = info.Alpha.ToString();
    countdown = 5.0f;
    }
    }

    public AgvDriveStatus GetInfo()
    {
    request = (HttpWebRequest)WebRequest.Create("http://141.60.104.41:50304/api/AgvInformation");
    response = (HttpWebResponse)request.GetResponse();
    reader = new StreamReader(response.GetResponseStream());
    jsonResponse = reader.ReadToEnd();
    info = JsonConvert.DeserializeObject<AgvDriveStatus>(jsonResponse);
    return info;
    }


    If anyone has an idea what i'm doing wrong or has a sample code of an working rest client or opc ua client i would be really thankfull

    Kind Regards,
    Stefan
     
    Mgravitus likes this.