SpatialOS uses schema to generate APIs specific to the components in your project. These APIs define how you can operate on entity components within SpatialOS.
To generate schema, select the Schema button in the GDK Toolbar. The GDK automatically iterates through classes with replicated properties to generate the required schema files and then updates the SchemaDatabase.
Image: In the GDK toolbar in the Unreal Editor, select Schema
As the GDK automatically generates all the schema you need, you do not have to write or edit schema manually when using the GDK.
When to generate schema
You must generate schema when you add or change any replicated properties (Unreal documentation) that you want to deploy to SpatialOS.
The GDK only generates schema for classes currently loaded into memory. This means if your project uses sublevels, you’ll need to load them in addition to your map, before generating schema.
When you generate schema, the GDK verifies that any classes referenced in the SchemaDatabase still exist. If you delete a class, the GDK removes it from the SchemaDatabase the next time you generate schema.
Schema and source control
Checking out the
Note: If you are using the built-in Unreal source control system Unreal locks this file on checkout, meaning other users are unable to write to it. To prevent this, mark the
SchemaDatabase file as writable locally on each machine, and only check out the file when you are ready to commit any changes made to it.
Schema for unique local classs
Whenever you generate schema, the GDK checks the SchemaDatabase and all the in-memory classes in your project and removes any classes referenced in the
SchemaDatabase that no longer exist.
This means that if you have a class that only exists on one user’s machine (for example, a newly created class, or a class used for local testing) then these classes are automatically removed from the SchemaDatabase file whenever another user generates schema.
To prevent this, commit newly created or modified classes to source control alongside the SchemaDatabase.