Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Having trouble with getting data to show up on my HoloLens

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)

Best Answer

  • Options
    Answer ✓

    Managed to fix my error, had unity 2017.3f1 installed.
    Fixed my errors by removing unity 2017.3f1 and installing 2017.2.1p2, and pulled the latest holotoolkit from github.

Answers

  • Options
    Answer ✓

    Managed to fix my error, had unity 2017.3f1 installed.
    Fixed my errors by removing unity 2017.3f1 and installing 2017.2.1p2, and pulled the latest holotoolkit from github.

Sign In or Register to comment.