Version: Unity 6.7 Alpha (6000.7)
Language : English
Configure Smart Strings
Handle formatting errors

Smart Strings settings reference

Customize the settings that control the project’s default Smart String formatter, including case sensitivity, error handling, and the active sources and formatters.

Open these settings from the main menu (Edit > Project Settings > Smart Strings), or by selecting a Smart Strings Settings asset in the Project window. The first time you open the page, select Create to make a settings asset. The settings define the default SmartFormatter reached at runtime through Smart.Project, and the asset is included in player builds. To set these values in code instead, refer to Configure Smart Strings.

Smart Strings settings

The Smart Strings settings contain the following sections.

Settings

Setting Description
Case Sensitivity Determines how selector and formatter names are matched. The following options are available:
  • Case Sensitive: Match names exactly. This is the default.
  • Case Insensitive: Ignore case when matching names.

Parser

Setting Description
Error Action Sets how the parser responds to an invalid format string. The following options are available:
  • Throw Error: Raise an exception. This is the default.
  • Output Error In Result: Write the error message into the output.
  • Ignore: Skip the error.
  • Maintain Tokens: Leave the offending placeholder unchanged in the output.
Refer to Handle formatting errors.
Convert Character String Literals Interprets character escapes such as \n and \t in the format string. Enabled by default. Refer to the escaping note in Smart Strings.
Custom Selector Chars Lists extra characters allowed in selectors, beyond letters, digits, _, and -. Use Add (+) and Remove () to edit the list.
Custom Operator Chars Lists extra characters treated as selector operators, in addition to . and ?.. Use Add (+) and Remove () to edit the list.

Formatter

Setting Description
Error Action Sets how a formatter responds when it can’t format a value. Has the same options as the parser Error Action, and defaults to Throw Error. Refer to Handle formatting errors.
Alignment Fill Character Sets the character used to pad a value to its alignment width, for example {value,10}. Defaults to a space.

Sources

The Sources list holds the sources the formatter tries, in order, to evaluate a placeholder’s selectors. The order matters: each source is tried from the top until one handles the selector.

  • Select Add (+) to choose a source type from the menu of available ISource implementations.
  • Select Remove () to remove the selected source.
  • Drag a source by its handle to reorder it.

Refer to the source pages, such as Default, Properties, Dictionary, and String.

Formatters

The Formatters list holds the formatters the formatter tries, in order, to convert a value to text. As with sources, the order matters for implicitly applied formatters.

  • Select Add (+) to choose a formatter type from the menu of available IFormatter implementations.
  • Select Remove () to remove the selected formatter.
  • Drag a formatter by its handle to reorder it.

Refer to the formatter pages, such as Choose, Plural, List, and Conditional.

Additional resources

Configure Smart Strings
Handle formatting errors