Network class not available on HoloLens builds (But works in Editor)

I’m trying to use Network.player.ipAddress to get the external IP of the HoloLens. In the editor, this works fine. But, if I try to make a HoloLens build, I get this error:

Assets\Scripts\Networking\NetworkingGUI.cs(44,59): error CS0103: The name ‘Network’ does not exist in the current context

It looks like the Network class is not in the actual native SDK? If not…what are we supposed to use instead?

This forum post might help with the answer you need.

Let us know if you still have questions

I think the another api that could work is Network Manager

@Unity_Wesley thanks a lot! I think that will work. I don’t think I could find a way to get the external IP using NetworkManager, it would always just report “localhost”. Any particular reason why the Network class doesn’t have a UWP version of it when compiling for HoloLens, or is that eventually on the agenda?

So far it’s the only class I’ve found unsupported on UWP, but I’m sure there are more. :slight_smile:

It’s a legacy class from the old networking system. There are no plans to ever support this class on UWP.

@Tautvydas-Zilys ah thanks! Will the functionality be merged into a different class? Network.isCilent and the ability to get access to Network.player for the IP are very handy.

IIRC the implementation in the old system relied on the facilitator (for NAT punchthrough) or connection tester reporting the external IP so this class could display it. We could add something similar to the new system, relying on a connection like this to report the IP (we’re adding NAT support right now and will have a facilitator for that). I’ll add this to our todo list.

Some news about that ?

I’ve done a simple discovery server/client using UNET. However, it seems to be missing NetworkPlayer when trying to compile to Hololens. Is this true?

I don’t get how to know what works and what not. Previously I did a UDP server/client which also didn’t work even though I using the preprocessor macro (and it worked fine on Windows 10, not just Hololens).

Any news/updates?

You can try using the EasClientDeviceInformation class. You can at least get the device name. Something like this:

#if WINDOWS_UWP
using Windows.Security.ExchangeActiveSyncProvisioning;
#endif
#if WINDOWS_UWP
               var info = new EasClientDeviceInformation();     
                    Debug.Log(info.FriendlyName);
                    Debug.Log(info.Id);
#endif

This only works on the HoloLens and not in the editor.