The Format Node receives a Pattern String that can contain format specifiers and data as a chosen number of parameters. It then outputs the String formatted with the parameters in place of the format specifiers. The format specifiers define the type of data that will fill them and the format the data will be shown in.

This Node is useful for when data needs to be presented within a text. For example, it can be utilized to show the current temperature. For this, we can use the Pattern String The current temperature is %.1f °C, where %.1f is the format specifier that indicates that a Float value with one decimal place will take that position in the final formatted String. The value of the current temperature has to be given to the Node as a Float value in the corresponding parameter Input Socket and then, if the current temperature is, say, 20.3 degrees Celsius, the formatted String that the Node outputs will be The current temperature is 20.3°C.

A more detailed description of format specifiers and usage examples of the Node can be found below.

Scope: Project, Scene, Function, Prefab.






Format Specifiers

Format specifiers are part of the input Pattern String and they indicate the place and format in which the data will be displayed.

They are written in the form %[width][.precision]type, where width and precision are optional and type is mandatory:

  • Width indicates the minimum number of characters to output, filling with blank spaces at the beginning when the data uses fewer characters. This is useful, for example, for when the number of digits in the input data can vary and we need to keep the data field aligned.

  • Precision indicates a maximum number of characters to output, depending on the type that is used. For Floats, it indicates the maximum number of digits right of the decimal point to use; for Strings, it limits the number of characters to output, truncating the input String if it exceeds this number.

  • Type indicates the Data Type with which the format specifier will be filled. The possible types are shown in the following table:

Usage Examples

The following table shows several examples on how to use the Format Node, specifying the inputs (Pattern, Parameter1, Parameter2) and the output (Formatted).

See Also

Last updated