Component:UnitSystemSwitcher: Difference between revisions

From Resonite Wiki
Automated: create new component page
 
This is no longer a stub. Added a description, added field description, added usage description.
 
Line 3: Line 3:
|Name=Unit System Switcher
|Name=Unit System Switcher
}}
}}
{{stub}}


== Usage ==
The '''UnitSystemSwitcher''' component takes in one [[Quantity Types|quantity type]] and converts it to another as a [[Type:string|string]].
 
{{Table ComponentFields
{{Table ComponentFields
|DefaultUnit|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv0=true|
|DefaultUnit|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv0=true| Changes the default unit to show in the text (especially if the <code>FormatUnit</code> is incorrect).
|FormatUnit|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv1=true|
|FormatUnit|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv1=true| The unit to show in the text.
|FormatNumber|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv2=true|
|FormatNumber|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv2=true| Formats the string.
|CompoundFormatUnits|{{RootFieldType|DriveRef`1|[[Type:SyncFieldList`1|SyncFieldList`1]]&lt;[[Type:String|String]]&gt;}}|TypeAdv3=true|
|CompoundFormatUnits|{{RootFieldType|DriveRef`1|[[Type:SyncFieldList`1|SyncFieldList`1]]&lt;[[Type:String|String]]&gt;}}|TypeAdv3=true| Compounds units together (example: feet and inches for height).
|CompoundOverrideNames|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true|
|CompoundOverrideNames|{{RootFieldType|FieldDrive`1|[[Type:Bool|Bool]]}}|TypeAdv4=true| Overrides the names.
|CompoundSeparator|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv5=true|
|CompoundSeparator|{{RootFieldType|FieldDrive`1|[[Type:String|String]]}}|TypeAdv5=true| Separates the compound units.
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv6=true|
|DefaultPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv6=true| The default preset.
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv7=true|
|ImperialPreset|{{RootFieldType|(nested)|[[#Preset|Preset]]}}|TypeAdv7=true| The imperial preset.
}}
}}


== Behavior ==
== Usage ==
Useful for unit conversions.


== Examples ==
== Examples ==

Latest revision as of 23:59, 12 September 2024

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.

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
DefaultUnit field drive of String Changes the default unit to show in the text (especially if the FormatUnit is incorrect).
FormatUnit field drive of String The unit to show in the text.
FormatNumber field drive of String Formats the string.
CompoundFormatUnits direct DriveRef`1<SyncFieldList`1<String>> Compounds units together (example: feet and inches for height).
CompoundOverrideNames field drive of Bool Overrides the names.
CompoundSeparator field drive of String Separates the compound units.
DefaultPreset direct Preset The default preset.
ImperialPreset direct Preset The imperial preset.

Usage

Useful for unit conversions.

Examples

See Also