Assemblies and the engine API
Kolpa splits code into two managed assemblies. Knowing which is which explains what you can edit and what the engine owns.
The two assemblies
Section titled “The two assemblies”| Assembly | Folder | Role |
|---|---|---|
Kolpa.Engine |
bindings/Kolpa.Engine/ |
The engine API: MonoBehaviour, GameObject, Transform, components, SceneManager, Input, UI. The engine host loads it. Treat it as read-only. |
Kolpa.Demo |
bindings/Kolpa.Demo/ |
Your game scripts. The engine loads this assembly and instantiates your MonoBehaviour classes by name. |
Your scripts live in Kolpa.Demo. They reach the engine through the Kolpa.Engine namespace.
Why two assemblies
Section titled “Why two assemblies”The engine host loads Kolpa.Engine once at startup. It loads Kolpa.Demo on top and can unload and reload it on hot reload. That is why you can change a gameplay script and reload without restarting the engine.
The engine assembly never reloads. Changing it needs a full rebuild and restart.
The bridge
Section titled “The bridge”The two sides talk through function-pointer tables, KpNativeApi on the C++ side and NativeApi on the C# side. Their layout must stay in sync. That is engine-internal. You never touch it from a script.
AOT builds
Section titled “AOT builds”A NativeAOT release build has no reloadable assembly. Scripts compile into the binary. MonoBehaviourRegistry holds a generated registry of every script type so AOT keeps the factories. Your code does not change. Only the build path does.
Adding a script
Section titled “Adding a script”- Add a
.csfile underbindings/Kolpa.Demo/. - Derive from
MonoBehaviour. - Build the project.
- Attach it through the Script component using its type name.
See Gameplay scripts for the shape.
Continue reading
Section titled “Continue reading”Previous: In-game UI: HUD and menus.
Next: Reference: generated type pages for the engine API.
