Quantcast
Channel: Recent Discussions — Mixed Reality Developer Forum
Viewing all articles
Browse latest Browse all 10543

Having trouble with getting data to show up on my HoloLens

$
0
0

Hey guys,

Lately I've been trying to get some data from an external source in the form of JSON.
The library I'm using is the unity fork of Newtonsoft.Json. When i run the project on my computer, it pulls data from the external source, and converts it to an object. The UI/text elements I've made should show the data pulled from my external source, when I run the project on my main computer it has no problems and the data shows up no problem, but when i send the project to my Hololens, my debugger gets data and i can literally see data is being pulled from the external source, but the data won't show up on the hololens. Can anyone enlighten me how i can fix this?

My code is as follows:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//using SimpleJSON;
using Newtonsoft.Json;

[System.Serializable]
public class TimeProperties
{
    public string Year { get; set; }
    public string Month { get; set; }
    public string Day { get; set; }
    public string Hour { get; set; }
    public string Minutes { get; set; }
    public string Seconds { get; set; }
}
[System.Serializable]
public class TimeClass
{
    public TimeProperties Time { get; set; }
}

public class test : MonoBehaviour
{
    string url = "http://172.16.24.135:8080";
    public Text year;
    public Text month;
    public Text day;
    public Text hour;
    public Text minutes;
    public Text seconds;

    private void Start()
    {
        StartCoroutine(UpdateValues());
    }

    IEnumerator PullJsonData()
    {
        Debug.Log("entered");

        WWW www = new WWW(url);
        yield return www;
        if(www.error != null)
        {
            print("There was an error getting the data: " + www.error);
            yield break;
        }
        string jsonstring = www.text;
        var data = JsonConvert.DeserializeObject<TimeClass>(jsonstring);
        Debug.Log(data.Time.Seconds);


        var jaren = data.Time.Year; //data["Year"].AsInt;
        var maanden = data.Time.Month;//data["Month"].AsInt;
        var dagen = data.Time.Day;//data["Day"].AsInt;
        var uren = data.Time.Hour;//data["Hour"].AsInt;
        var minuten = data.Time.Minutes;//data["Minutes"].AsInt;
        var seconden = data.Time.Seconds;//data["Seconds"].AsInt;
        year.text = "Year: " + jaren;
        month.text = "Month: " + maanden;
        day.text = "Days: " + dagen;
        hour.text = "Hours: " + uren;
        minutes.text = "Minutes: " + minuten;
        seconds.text = "Seconds: " + seconden;
    }

    IEnumerator UpdateValues()
    {
        while (true)
        {
            StartCoroutine(PullJsonData());
            yield return new WaitForSeconds(1);
        }
    }
}

I send it to my hololens via Visual studio code 2017 using "Release x86". I also get the following error:
(Filename: 'C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
Display is Transparent
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
There was an error getting the data:
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)
Failed to get spatial stage statics - can't retrieve or interact with boundaries! Error code: '0x80040154'.
(Filename: C:\buildslave\unity\build\Runtime/VR/HoloLens/StageRoot.cpp Line: 20)
entered
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)'

I pull my JSON data from my external source every second, so every second after runtime, this shows up in my debug:
entered(this is a debug.log inside the class pulljsondata()).
There was an error getting the data:
(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)


Viewing all articles
Browse latest Browse all 10543

Trending Articles