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.

Connecting using Unity's UNET doesn't work after the first time connecting

I am trying to get Unity's built-in networking set up for Hololens, and I have just a basic UI and script to will either start a host or join a host.

Here is my code:
void Start() { netManager = GameObject.Find("Networking").GetComponent<HololensNetworkManager>(); } public void StartGameServer() { netManager.serverBindAddress = ip; netManager.serverBindToIP = true; netManager.networkAddress = ip; netManager.networkPort = port; netManager.StartHost(); } public void StartGameClient() { netManager.networkAddress = ip; netManager.networkPort = port; netManager.StartClient(); }
The HololensNetworkManager component is just an extension of the standard NetworkManager component that I use to override the OnClientConnect and OnServerConnect functions for debugging purposes.

The port variable is set to 7777 and the ip variable is hard-coded with the IPv4 address of the Hololens obtained from the device settings.

I can open the app on the Hololens and then run StartGameServer, and then start playing in the editor on my computer and run StartGameClient from there and it works fine once. The OnClientConnect and OnServerConnect functions get hit, and my debugging code runs. However, running this flow again (without changing any code! just fully closing the app on the Hololens/stopping in the editor and re-opening) the OnClientConnect and OnServerConnect on the Hololens do not get hit and my debugging text doesn't show up.

Are there certain behaviors with UWP and Unity's built-in networking that cause this? Any ideas on how I can fix/get around it? I haven't seem to found anyone else running into this issue so I'm not sure what I'm missing.



  • I've been using UNet with the HoloLens a lot for the past few months and haven't had any issues like that, except when I don't completely close the application as I'm deploying with Visual Studio. Sometimes even though you "bloom-out" of the application, it will still be running in the background and when you open another instance of the app through the HoloLens menu, the one that was left behind will still think that has an active connection making the new instance pretty much useless. What I do to avoid that is to bloom-out, open the app again, close it and then open it again, that way I make sure that the application is not running. Or make sure you hit the stop button in Visual Studio.

    As another troubleshooting step, have you tried using the default network manager without the overrides and see if you get the same behavior?

  • I want to send some data from my HoloLens to my PC when the unity app is running. Can you help me with your knowledge?
    Looking forward your reply! Thank you.

Sign In or Register to comment.