Version: Unity 7.0 Alpha (7000.0)
Language : English
Create a custom source
Choose formatter

Use formatters to apply logic to strings

Browse the formatters that convert a selected value into text in a Smart String.

A formatter converts the value produced by the sources into its final text, applying logic such as pluralization, lists, or conditional output. Apply a formatter explicitly by name, or omit the name to let a formatter that supports automatic detection apply implicitly. The following formatters are available, and you can add your own.

Formatter Description
Choose formatter Picks an output by matching the value against a set of options.
Conditional formatter Picks an output based on the value’s type and value.
Default formatter Converts the value with ToString and the active culture.
Is Match formatter Picks an output based on a regular expression match.
List formatter Formats each item in a list, with separators.
Null formatter Picks an output based on whether the value is null.
Plural formatter Picks a word form based on a count and the culture’s plural rules.
Sub string formatter Extracts a substring of the value.
Template formatter Applies a reusable named template.
Time formatter Formats a TimeSpan, or the time since a DateTime or DateTimeOffset, as localized text.
Create a custom formatter Write your own formatter.

Additional resources

Create a custom source
Choose formatter
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961