Unity 使用自定义的优化 YAML 库(称为 UnityYAML)。UnityYAML 库不支持完整的 YAML 规范。本文档概述 UnityYAML 支持 YAML 规范的哪些部分。
无法在外部生成或编辑 UnityYAML 文件。
功能 | 支持 |
---|---|
映射 | UnityYAML 支持流样式和块样式。 |
标量 | UnityYAML 支持双引号和单引号标量以及普通标量。可以将标量拆分为多行。请注意,多行标量可能会在解析过程中产生性能和内存开销。 分成多行的普通标量必须比前一行缩进更多。请参阅下表以查看示例。 您可以在标量中使用 UTF–8 字符,但是 UnityYAML 仅在这些字符是双引号标量的一部分时才会对这些字符解码。 |
序列 | UnityYAML 支持映射、块样式以及包含块映射的块序列。 |
parent: This is a
multi-line scalar
^
|
如果没有缩进,则标量返回 This is a
,并可能触发资源的进一步解析。
功能 | 支持 |
---|---|
Chomping 指示符 | 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. |
注释 | UnityYAML 不支持注释。 |
复杂映射键 | UnityYAML 不支持复杂映射键。 |
多个文档 | 阅读器会跳过文件顶部的文档和标签前缀,但不会处理由多个文档组成的 YAML 输入。 |
原始块序列 | 在 UnityYAML 中,几乎所有节点都是映射的一部分,因此所有序列都必须是某个映射的值才能正常工作。请参阅下表以查看示例。 匿名序列会增加解析器的复杂性。您不能使用缩进来确定序列元素是否已在 UnityYAML 中完成。 |
标签 | UnityYAML 不支持标签。 |
var:
- 1
- 2
- 3
该序列用于 var
上的查找,因此以下内容不起作用:
- 1
- 2
- 3
2019–05–13 页面已发布
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.