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.
You cannot externally produce or edit UnityYAML files.
Feature | Support |
---|---|
Mappings | UnityYAML supports both flow and block styles. |
Scalars | UnityYAML 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. |
Sequences | UnityYAML supports mapping, block styles, and block sequences that contain block mappings. |
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.
Feature | Support |
---|---|
Chomping indicators | UnityYAML does not support using + and | characters to indicate how it should treat new lines within a multi-line string. If you use these characters, UnityYAML adds them to the scalar value. |
Comments | UnityYAML does not support comments. |
Complex mapping keys | UnityYAML does not support complex mapping keys. |
Multiple documents | The reader skips document and tag prefixes at the top of files, but does not handle YAML input that consists of multiple documents. |
Raw block sequences | Nearly 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. |
TagsA reference word which you can assign to one or more GameObjects to help you identify GameObjects for scripting purposes. For example, you might define and “Edible” Tag for any item the player can eat in your game. More info See in Glossary |
UnityYAML does not support tags. |
var:
- 1
- 2
- 3
The sequence is designed for lookups upon var
, so the following does not work:
- 1
- 2
- 3
2019–05–13 Page published
New in 2019.3 NewIn20193
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.