Get SpatialOS

Sites

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

spatial schema generate

Generates code and output for one of the target languages.

Description

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]

Options

      --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,javascript,proto,typescript). 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.
      --protoc_path string   Path to override the 'protoc' command.
  -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.
      --no_animation   Disable dynamic output elements such as the spinner, progress bars, etc.

See also

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums