UnitsAttributeDrawer Class

Summary

[Editor-Only] A UnityEditor.PropertyDrawer for fields with a Animancer.Units.UnitsAttribute.
Assembly
Animancer.dll
Namespace
Animancer.Units.Editor
Base Types
  • PropertyDrawer
Derived Types
graph BT Type-->Base0["PropertyDrawer"] Type["UnitsAttributeDrawer"] class Type type-node Derived0["AnimationTimeAttributeDrawer"]-->Type click Derived0 "/animancer/api/Animancer.Units.Editor/AnimationTimeAttributeDrawer" Derived1["AnimationSpeedAttributeDrawer"]-->Type click Derived1 "/animancer/api/Animancer.Units.Editor/AnimationSpeedAttributeDrawer"

Syntax

[CustomPropertyDrawer(typeof(UnitsAttribute), true)]
public class UnitsAttributeDrawer : PropertyDrawer

Attributes

Type Description
CustomPropertyDrawer

Properties

Name Value Summary
Attribute UnitsAttribute
The attribute on the field being drawn.
DisplayConverters CompactUnitConversionCache[]
The converters used to generate display strings for each of the fields.

Methods

Name Value Summary
BeginProperty(Rect, SerializedProperty, GUIContent, float) void
Begins a GUI property block to be ended by Animancer.Units.Editor.UnitsAttributeDrawer.EndProperty(UnityEngine.Rect,UnityEditor.SerializedProperty,System.Single@).
static
DoFieldGUI(Rect, GUIContent, float) void
Draws this attribute's fields.
DoOptionalAfterGUI(bool, Rect, float, float, bool, float) void
Draws a toggle to set the `value` to System.Single.NaN when disabled.
DoOptionalBeforeGUI(bool, Rect, Rect, bool, float) void
Prepares the details for drawing a toggle to set the field to System.Single.NaN.
DoSpecialFloatField(Rect, GUIContent, float, CompactUnitConversionCache) float
Draws a UnityEditor.EditorGUI.FloatField(UnityEngine.Rect,UnityEngine.GUIContent,System.Single) with an alternate string when it's not selected (for example, "1" might display as "1s" to indicate "seconds").
static
EndProperty(Rect, SerializedProperty, float) void
Ends a GUI property block started by Animancer.Units.Editor.UnitsAttributeDrawer.BeginProperty(UnityEngine.Rect,UnityEditor.SerializedProperty,UnityEngine.GUIContent@,System.Single@).
static
GetDisplayValue(float, float) float
Returns the value that should be displayed for a given field.
static
GetLineCount(SerializedProperty, GUIContent) int
Determines how many lines tall the `property` should be.
GetPropertyHeight(SerializedProperty, GUIContent) float
Initialize() void
Gathers the Animancer.Units.Editor.UnitsAttributeDrawer.Attribute and sets up the Animancer.Units.Editor.UnitsAttributeDrawer.DisplayConverters.
Initialize(Attribute) void
Gathers the Animancer.Units.Editor.UnitsAttributeDrawer.Attribute and sets up the Animancer.Units.Editor.UnitsAttributeDrawer.DisplayConverters.
OnGUI(Rect, SerializedProperty, GUIContent) void
Draws this attribute's fields for the `property`.