Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


UnityYAML

Learn about Unity's implementation of YAML and the specific conventions used in scene files.
Read time 2 minutesLast updated 9 days ago

Unity uses a custom-optimized YAML library called UnityYAML. The UnityYAML library does not support the full YAML specification. This documentation outlines which parts of the YAML spec UnityYAML supports.
Avoid generating or editing Unity YAML files directly. Consider using existing Unity API to update relevant YAML fields.

Supported features

Feature

Support

MappingsUnityYAML supports both flow and block styles.
ScalarsUnityYAML supports double and single quoted scalars as well as plain scalars. You can split them onto multiple lines. Be aware that multi-line scalars can create performance and memory overheads during parsing.

Plain scalars split onto multiple lines must be indented more than the previous line. See below this table for an example.

You can use UTF-8 characters in scalars, but UnityYAML only decodes them when they are part of a double quoted scalar.
SequencesUnityYAML supports mapping, block styles, and block sequences that contain block mappings.

Example of indentation on multi-line plain scalars:

parent: This is a multi-line scalar^|
If there is no indentation, the scalar returns
This is a
and might trigger an Asset into further parsing.

Unsupported features

Feature

Support

Chomping indicatorsUnityYAML does not support using
+
and `
CommentsUnityYAML does not support comments.
Complex mapping keysUnityYAML does not support complex mapping keys.
Multiple documentsThe reader skips document and tag prefixes at the top of files, but does not handle YAML input that consists of multiple documents.
Raw block sequencesNearly all nodes are part of a mapping in UnityYAML, so all sequences must be values of a mapping to work correctly. See below this table for an example.

Anonymous sequences increase the parser complexity. You cannot use indentation as a way of determining if a sequence element has finished in UnityYAML.
TagsUnityYAML does not support tags.

Example of a raw block sequence

var: - 1 - 2 - 3
The sequence is designed for lookups upon
var
, so the following does not work:
- 1- 2- 3