Skip to content

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.

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.

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 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.

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.

  1. Add a .cs file under bindings/Kolpa.Demo/.
  2. Derive from MonoBehaviour.
  3. Build the project.
  4. Attach it through the Script component using its type name.

See Gameplay scripts for the shape.

Previous: In-game UI: HUD and menus.

Next: Reference: generated type pages for the engine API.