UnitsAttribute Class

Summary

[Editor-Conditional] Causes a float field to display a suffix to indicate what kind of units the value represents as well as displaying it as several different fields which convert the value between different units.
graph BT Type-->Base0["PropertyAttribute"] Type["UnitsAttribute"] class Type type-node Derived0["AnimationSpeedAttribute"]-->Type click Derived0 "/animancer/api/Animancer.Units/AnimationSpeedAttribute" Derived1["DegreesPerSecondAttribute"]-->Type click Derived1 "/animancer/api/Animancer.Units/DegreesPerSecondAttribute" Derived2["MetersAttribute"]-->Type click Derived2 "/animancer/api/Animancer.Units/MetersAttribute" Derived3["MetersPerSecondAttribute"]-->Type click Derived3 "/animancer/api/Animancer.Units/MetersPerSecondAttribute" Derived4["DegreesAttribute"]-->Type click Derived4 "/animancer/api/Animancer.Units/DegreesAttribute" Derived5["MetersPerSecondPerSecondAttribute"]-->Type click Derived5 "/animancer/api/Animancer.Units/MetersPerSecondPerSecondAttribute" Derived6["AnimationTimeAttribute"]-->Type click Derived6 "/animancer/api/Animancer.Units/AnimationTimeAttribute" Derived7["MultiplierAttribute"]-->Type click Derived7 "/animancer/api/Animancer.Units/MultiplierAttribute" Derived8["PerSecondAttribute"]-->Type click Derived8 "/animancer/api/Animancer.Units/PerSecondAttribute" Derived9["SecondsAttribute"]-->Type click Derived9 "/animancer/api/Animancer.Units/SecondsAttribute"

Syntax

[System.Diagnostics.Conditional(Strings.UnityEditor)]
public class UnitsAttribute : PropertyAttribute

Remarks

Documentation: Units Attribute

Attributes

Type Description
ConditionalAttribute

Constructors

Name Summary
UnitsAttribute() Creates a new Animancer.Units.UnitsAttribute.
UnitsAttribute(float[], string[], int) Creates a new Animancer.Units.UnitsAttribute.
UnitsAttribute(string) Creates a new Animancer.Units.UnitsAttribute.

Fields

Name Constant Value Summary
Multipliers
The multipliers to convert from the field's actual value to each unit type.
Suffixes
The unit suffix to display at the end of the value in each field.
UnitIndex
The index of the multiplier where the field stores its actual value.

Properties

Name Value Summary
DefaultValue float
The value to display if the actual value is System.Single.NaN.
DisabledText string
Optional text to display instead of the regular fields when the value is System.Single.NaN.
IsOptional bool
Should the field have a toggle to set its value to System.Single.NaN?
Rule Validate.Value
The validation rule applied to the value.