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["SelfDrawerAttribute"] click Base0 "/animancer-v7-4/api/Animancer/SelfDrawerAttribute" Base0-->Base1["PropertyAttribute"] Type["UnitsAttribute"] class Type type-node Derived0["MultiplierAttribute"]-->Type click Derived0 "/animancer-v7-4/api/Animancer.Units/MultiplierAttribute" Derived1["SecondsAttribute"]-->Type click Derived1 "/animancer-v7-4/api/Animancer.Units/SecondsAttribute" Derived2["MetersPerSecondAttribute"]-->Type click Derived2 "/animancer-v7-4/api/Animancer.Units/MetersPerSecondAttribute" Derived3["DegreesAttribute"]-->Type click Derived3 "/animancer-v7-4/api/Animancer.Units/DegreesAttribute" Derived4["AnimationSpeedAttribute"]-->Type click Derived4 "/animancer-v7-4/api/Animancer.Units/AnimationSpeedAttribute" Derived5["MetersAttribute"]-->Type click Derived5 "/animancer-v7-4/api/Animancer.Units/MetersAttribute" Derived6["DegreesPerSecondAttribute"]-->Type click Derived6 "/animancer-v7-4/api/Animancer.Units/DegreesPerSecondAttribute" Derived7["AnimationTimeAttribute"]-->Type click Derived7 "/animancer-v7-4/api/Animancer.Units/AnimationTimeAttribute" Derived8["MetersPerSecondPerSecondAttribute"]-->Type click Derived8 "/animancer-v7-4/api/Animancer.Units/MetersPerSecondPerSecondAttribute"

Syntax

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

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.

Properties

Name Value Summary
DefaultValue float
[Editor-Only] The value to display if the actual value is System.Single.NaN.
DisplayConverters CompactUnitConversionCache[]
[Editor-Only] The converters used to generate display strings for each of the fields.
IsOptional bool
[Editor-Only] Should the field have a toggle to set its value to System.Single.NaN?
LineHeight float
[Editor-Only] Returns Animancer.Editor.AnimancerGUI.LineHeight.
static
Multipliers float[]
[Editor-Only] The unit conversion ratios.
Rule Validate.Value
The validation rule applied to the value.
StandardSpacing float
[Editor-Only] Returns Animancer.Editor.AnimancerGUI.StandardSpacing.
static
UnitIndex int
[Editor-Only] The index of the Animancer.Units.UnitsAttribute.DisplayConverters for the attributed serialized value.

Methods

Name Value Summary
BeginProperty(Rect, SerializedProperty, GUIContent, float) void
[Editor-Only] Begins a GUI property block to be ended by Animancer.Units.UnitsAttribute.EndProperty(UnityEngine.Rect,UnityEditor.SerializedProperty,System.Single@).
static
CanCacheInspectorGUI(SerializedProperty) bool
[Editor-Only] Can the GUI for the `property` be cached?
Inherited from SelfDrawerAttribute
DoFieldGUI(Rect, GUIContent, float) void
[Editor-Only] Draws this attribute's fields.
DoSpecialFloatField(Rect, GUIContent, float, CompactUnitConversionCache) float
[Editor-Only] Draws a UnityEditor.EditorGUI.FloatField(UnityEngine.Rect,UnityEngine.GUIContent,System.Single) with an alternate string when it is not selected (for example, "1" might become "1s" to indicate "seconds").
static
EndProperty(Rect, SerializedProperty, float) void
[Editor-Only] Ends a GUI property block started by Animancer.Units.UnitsAttribute.BeginProperty(UnityEngine.Rect,UnityEditor.SerializedProperty,UnityEngine.GUIContent@,System.Single@).
static
GetDisplayValue(float, float) float
[Editor-Only] Returns the value that should be displayed for a given field.
static
GetLineCount(SerializedProperty, GUIContent) int
[Editor-Only] Determines how many lines tall the `property` should be.
GetPropertyHeight(SerializedProperty, GUIContent) float
[Editor-Only] Calculates the height of the GUI for the `property`.
OnGUI(Rect, SerializedProperty, GUIContent) void
[Editor-Only] Draws this attribute's fields for the `property`.
SetUnits(float[], CompactUnitConversionCache[], int) void
[Editor-Only] Sets the unit details.