Shared C# libraries
Code several games share, such as a networking layer, maths or a data format, can live in an ordinary C# class library outside the project. The editor builds it, Play loads it and the packaged game ships it.
Reference the library
Add a ProjectReference to the game's scripts project (Content/Scripts/<Name>Scripts.csproj) with a path relative to it, so the reference works on every machine with the same folder layout. The editor never rewrites a scripts project you changed, so the reference stays.
The library targets net10.0 like the scripts and needs no engine reference. It may reference EngineScriptCore the same way the scripts project does when it contains scripts itself. Prebuilt libraries (Reference with a HintPath) and NuGet packages (PackageReference) work too.
MyGameScripts.csproj
<ItemGroup> <ProjectReference Include="..\..\..\SharedLibs\MyNet\MyNet.csproj" /> </ItemGroup>
In the editor
The script build builds the library, copies its DLL next to the gameplay assembly and lists it in the gameplay .deps.json; Play loads it from there. The editor's file watcher sees only the project's script folder: after changing only the library, run Tools › Scripting › Build Scripts.
In the packaged game
Build Gameplay & Export publishes the scripts project; the gameplay assembly, every library it references and the .deps.json ship as the game's gameplay output and the player loads the library from there. Keep the library free of editor-only dependencies: everything it references ships with the game.
KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.