(One intermediate revision by one other user not shown)
Line 4:
Line 4:
}}
}}
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 12:
Line 12:
|CompoundFormatUnits|{{RootFieldType|DriveRef`1|[[Type:SyncFieldList`1|SyncFieldList`1]]<[[Type:String|String]]>}}|TypeAdv3=true| Compounds units together (example: feet and inches for height).
|CompoundFormatUnits|{{RootFieldType|DriveRef`1|[[Type:SyncFieldList`1|SyncFieldList`1]]<[[Type:String|String]]>}}|TypeAdv3=true| Compounds units together (example: feet and inches for height).
|CompoundOverrideNames|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true| Overrides the names.
|CompoundOverrideNames|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true| Overrides the names.
|CompoundSeparator|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv5=true| Separates the compound units.
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv6=true| The default preset.
|CompoundSeparator|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv6=true| Separates the compound units.
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv7=true| The imperial preset.
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|UnitSystemSwitcher.Preset]]}}|TypeAdv7=true| The default preset.
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|UnitSystemSwitcher.Preset]]}}|TypeAdv8=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 33:
== 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]]
Latest revision as of 06:05, 17 March 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.