Version: Unity 7.0 Alpha (7000.0)
Language : English
List formatter
Plural formatter

Null formatter

Output different text depending on whether a value is null.

The Null formatter checks whether the placeholder value is null and outputs one of up to two formats. Apply it explicitly with the name isnull. It also treats a destroyed UnityEngine.Object as null.

The required first format of the Null formatter is used when the value is null. The optional second format is used otherwise. When only one format is provided, a non-null value outputs nothing. The second format can reuse the value with an empty placeholder {}.

Separate the formats with the split character. The default is |, but , and ~ are also valid.

Smart String Argument Result
{0:isnull:It's null} null It’s null
{0:isnull:It's null} "Lara" (empty)
{0:isnull:It's null\|Not null} null It’s null
{0:isnull:It's null\|Not null} "Lara" Not null
{0:isnull:It's null\|{}} "Lara" Lara

Additional resources

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