These are the docs for 13.8, an old version of SpatialOS. The docs for this version are frozen: we do not correct, update or republish them. 14.5 is the newest →

spatial schema generate

Generates code and output for one of the target languages.


Generates worker-specific code from the schema.

Use the '–language' flag to generate code for a specific language.

The input directory is searched for .schema files, which should define a (possibly partial) entity component schema in the SpatialOS schema language.

The .schema files are compiled via an intermediate protobuf representation to produce API code that can be used by workers and behaviours to create, read and write the state of entities in a SpatialOS simulation.

For more information on defining schemas, see the SpatialOS documentation.

spatial schema generate [flags]


      --cachePath string     Path to store intermediate data in. (default ".spatialos/schema_codegen_cache")
  -d, --dependency strings   Library directory containing .schema files. Like --input, but no code is generated for these files. Can be specified multiple times. (default [[]])
      --force                Regenerate all code, even if sources haven't changed.
  -i, --input strings        Input directory containing .schema files. Can be specified multiple times. (default [[${PROJECT_ROOT}/schema," [${PROJECT_ROOT}/build/dependencies/schema/${DEPENDENCY_NAME}"," ...]]"])
  -L, --language string      Language to generate code for. Supported values are (ast_proto,ast_json,cpp,csharp,java,proto). To generate code for different languages into different locations, run the command multiple times. The language flag is required.
  -o, --output string        Output directory for generated code. The directory will be fully cleaned before code generation.
  -R, --repository strings   Repository directory containing subdirectories with schema dependencies. Equivalent to adding --dependency for each immediate subdirectory of the specified repository directory. Can be specified multiple times. (default [[]])
      --version string       Spatial SDK version to download the schema compiler executable from.

Options inherited from parent commands

      --json_output            Print output in JSON format. Useful when you need to parse the Spatial CLI output.
      --log_directory string   Sets the directory log files will be created in. If not specified, this is set to <project_root>/logs when inside a project directory and logging is disabled when outside a project directory.
      --log_level string       Sets the log level. Available log levels: debug, info, warning, error, fatal, or panic.
      --main_config string     The path to your project's main configuration file (usually called spatialos.json)
      --no_animation           Disable dynamic output elements such as the spinner, progress bars, etc.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums