Shared Code

Unity uses C# code, and so do Microservices. The same C# code can run in Unity and a Microservice.

In Unity, you can set up an Assembly Definition that will be imported to a Microservice. The Assembly Definition may reference other assemblies, or even reference custom .dll files in Unity. However, please keep in mind that anything referenced will be executing within the Microservice.

🚧

Be careful about Licensing!

Beamable provides a shim for a few of the most common UnityEngine and UnityEditor types so that you can use them from a Microservice, but it is against Unity's license agreement to run Unity software without additional serial keys. The Microservice build process will not let you reference the full UnityEngine assemblies to avoid license issues. However, the same principle may apply to other licensed code, and Beamable does not make any custom accommodations for any assembly other than the standard Unity assemblies.


Every Beamable project will create a default Assembly Definition in /Assets/Beamable/Common. This Assembly is included by default in Microservices. Any class file you create in this folder will be part of the default shared Assembly, and therefor will be available from the Microservice.

Each Microservice can configure the Assembly Definitions that are imported to the service. In the Beam Services window, select a service, and then select the Config button in the top of the window. In the config section, there is a list of referenced Assembly Definitions. You can add any Assembly Definition.

To create a new shared Assembly Definition, you need to create a regular Assembly Definition, and then add it to the list in the config section.

All shared assemblies will be cause dotnet compatible projects to generate in your Unity project's /Library/BeamEditor/generatedProjects folder. These projects are automatically referenced in your Microservice's .csproj file.