The '''UnitSystemSwitcher''' component takes in one [[Quantity Types|quantity type]] and converts it to another as a [[Type:string|string]].
The '''UnitSystemSwitcher''' component takes in one [[Quantity Types|quantity type]] and converts it to another as a [[Type:string|string]]. This is commonly used to make editors easily able to take any unit input and automatically know which one the user is referring to.
{{Table ComponentFields
{{Table ComponentFields
Line 15:
Line 15:
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv6=true| The default preset.
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv6=true| The default preset.
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv7=true| The imperial preset.
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv7=true| The imperial preset.
}}
== Preset ==
{{Table TypeFields
|DefaultUnit|String| The default unit for this unit type.
|FormatUnit|String| The unit to show in the text.
|FormatNumber|String| How to format the string.
|CompoundFormatUnits|{{RootFieldType|SyncFieldList`1|[[Type:String|String]]}}|TypeAdv3=true| A list of compound format units from a unit configuration.
|CompoundSeparator|String| The Separator for compound units for this preset.
|CompoundOverrideNames|Bool| Overrides the names.
|CompoundUseLongNames|Bool| Whether compound units should use long names (So millimeters vs mm)
}}
}}
Line 21:
Line 32:
== Examples ==
== Examples ==
{{stub}}
== See Also ==
== See Also ==
* [[Component:QuantityTextFormatDriver]]
[[Category:Components:Common UI:Editors:Utility{{#translation:}}|Unit System Switcher]]
[[Category:Components:Common UI:Editors:Utility{{#translation:}}|Unit System Switcher]]
[[Category:Components{{#translation:}}|Unit System Switcher]]
[[Category:Components{{#translation:}}|Unit System Switcher]]
[[Category:Components With Nested Types{{#translation:}}|Unit System Switcher]]
[[Category:Components With Nested Types{{#translation:}}|Unit System Switcher]]
[[Category:ComponentStubs]]
Revision as of 05:54, 6 February 2025
Component image
Unit System Switcher component as seen in the Scene Inspector
The UnitSystemSwitcher component takes in one quantity type and converts it to another as a string. This is commonly used to make editors easily able to take any unit input and automatically know which one the user is referring to.