Class HexIntDrawer
Custom property drawer that renders HexIntAttribute int fields in the Unity Inspector as hexadecimal strings.
[CustomPropertyDrawer(typeof(HexIntAttribute))]
public class HexIntDrawer : PropertyDrawer
Inheritance
Remarks
This drawer applies to fields of type int or long. It will show the value with a 0x
prefix in the Inspector and convert it back from a hex string on input. If parsing fails, the value
defaults to 0.
Methods
OnGUI(Rect, SerializedProperty, GUIContent)
Draws the property field in the Unity Inspector.
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Parameters
| Name | Type | Description |
|---|---|---|
position | Rect | Rectangle on the screen to use for the property GUI. |
property | SerializedProperty | The SerializedProperty to make the custom GUI for. |
label | GUIContent | The label of this property. |