ドキュメント

Unity Engine

Unity Engine

Null formatter

Output different text depending on whether a value is null.
読み終わるまでの所要時間 1 分最終更新 24日前

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