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.

HoloLens Network Connection Works in Unity but not Device

Good afternoon! Thanks for taking the time to read this. My issue is that I am running Unity C# code to access a URL with the WWW call. The script works in Unity 5.6.1f1, but I am having no luck on the device. The device can access an HTML page from the same server in Edge. Is there some reason this approach will not work on the device?

Thanks for all suggestions!

David

using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;

public class CommTest3 : MonoBehaviour {

    //Server and HoloLens are on same WiFi. Verified communication with HoloLens Edge browser.
    public string url = "http://192.168.1.130/hviaddin/hviaddin.exe/Home"; 
    private delegate void TextDelegate(string text);
    public bool CommStatus = false;

    // Use this for initialization
    void Start()
    {
        StartCoroutine(DownloadTest(url, PrintText));
    }

    // Update is called once per frame
    void Update()
    {

    }
    private IEnumerator DownloadTest(string url, TextDelegate output)
    {
        WWW www = new WWW(url);
        yield return www;
        output(www.text);
    }

    private void PrintText(string text)
    {
        Debug.Log(text);  // shows HTML received in Unity.
        CommStatus = true;  // I am using a cube that turns from red to green to shown successful communication.
    }
}
Tagged:

Best Answer

  • Accepted Answer

    Okay, there is nothing like posting in the forum for enabling you to finally find the solution to your problem. First, under project settings, Player settings, InternetClient was not checked. Second, my experience matches this thread: https://forum.unity3d.com/threads/www-failing.417488/#post-2730311. I believe that WWW does not work on the HoloLens device, and so switching to UnityWebRequest solved my problem. Cheers!

Answers

  • Accepted Answer

    Okay, there is nothing like posting in the forum for enabling you to finally find the solution to your problem. First, under project settings, Player settings, InternetClient was not checked. Second, my experience matches this thread: https://forum.unity3d.com/threads/www-failing.417488/#post-2730311. I believe that WWW does not work on the HoloLens device, and so switching to UnityWebRequest solved my problem. Cheers!

Sign In or Register to comment.