Skip to main content

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​

NameTypeDescription
positionRectRectangle on the screen to use for the property GUI.
propertySerializedPropertyThe SerializedProperty to make the custom GUI for.
labelGUIContentThe label of this property.