'''ValueTextFormatDriver''' applies the value of a single source field to a [https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=net-5.0#get-started-with-the-stringformat-method text format string] and drives the target string field. The source field is element 0 in the format string. Elements are defined by putting {} brackets around a number. Although the image shown and the field list below have the source field being a float, this component is generic, so any field type (that can be converted to a string) can be used.
'''ValueTextFormatDriver''' applies the value of a single source field to a [https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=net-5.0#get-started-with-the-stringformat-method text format string] and drives the target string field. The source field is element 0 in the format string. Although the image shown and the field list below have the source field being a float, this component is generic, so any field type (that can be converted to a string) can be used.
<!--T:2-->
<!--T:2-->
== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|Source|IField`1|TypeString0=IField<float>| The source field for the value.
|Source|{{RootFieldType|RelayRef`1|[[Type:IField`1|IField`1]]<T>}}|TypeAdv0=true| The source field for the value.
|Format|String| The string format.
|Format|String| The string format with "{0}" in it somewhere
|Text|IField`1|TypeString2=IField<string>| The target field.
|Text|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv2=true| The target field.
}}
}}
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
Attach to a slot and provide a format string and source value in order to drive a string field (possibly text) with the formatted number.
<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
Can be used to drive the descriptions on [[UIX]], context menus, or visuals.
<!--T:5-->
<!--T:5-->
== Related Components ==
== See Also ==
* [[Component:StringConcatenationDriver|StringConcatenationDriver]] for combining the output with multiple other bits of text for a more robust final product.
* [[MultiValueTextFormatDriver (Component)|MultiValueTextFormatDriver]] for more than one source.
* [[Component:MultiValueTextFormatDriver|MultiValueTextFormatDriver]] for more than one source.
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Value Text Format Driver`1]]
[[Category:Components{{#translation:}}|Value Text Format Driver`1]]
[[Category:Generic Components{{#translation:}}|Value Text Format Driver`1]]
[[Category:Components:Utility{{#translation:}}|Value Text Format Driver`1]]
[[Category:Components:Utility{{#translation:}}|Value Text Format Driver`1]]
Latest revision as of 23:05, 3 February 2025
Component image
Value Text Format Driver`1 component as seen in the Scene Inspector
ValueTextFormatDriver applies the value of a single source field to a text format string and drives the target string field. The source field is element 0 in the format string. Elements are defined by putting {} brackets around a number. Although the image shown and the field list below have the source field being a float, this component is generic, so any field type (that can be converted to a string) can be used.