Networking dll In Separate Application

Can the UnityEngine.Networking.dll be used outside of Unity in a separate C# application?

I am trying to write my MasterServer application as a separate C# project to leverage the ease of using WinForms and without the overhead of running within Unity.

I followed the ReadMe from (https://bitbucket.org/Unity-Technologies/networking) and added the dll to my project, but I am getting a run-time SecurityException (due to UnityEngine not running).

Technically yes. You can use the source code of the “UnityEngine.Networking.dll” any way you like at least you respect it’s license.

However practically it’s going to be difficult as it does not contain the whole networking system but only the high level API and classes (as you can read in the readme file). The low-level API on which this library builds on top is not open source and not included in this DLL. The NetworkTransport layer is part of the Unity engine and can’t be used seperately.

Though if you invest some time you could recreate the low level API yourself so the Networking DLL can use your lowlevel API. Of course you would need to recreate it with the exact same interfaces and classes

Just to be clear: The UnityEngine.dll can’t be used outisde a Unity application as it relies on the native engine core. So you have to create your own “replacement” UnityEngine.dll and recreate the classes and functionality that is required by the networking library.

In most cases it’s not worth it. Some classes in the DLL directly use some base classes of Unity (such as GameObject or the NetworkIdentity component). To use the DLL in a standalone project you would need to reproduce most of the basic Unity gameobject system.