Class ScriptableObjectIdDrawer
Custom property drawer for ScriptableObjectIdAttribute. Automatically assigns the scriptable object asset's GUID to the target string field, and displays it as a read-only string in the Unity Inspector.
[CustomPropertyDrawer(typeof(ScriptableObjectIdAttribute))]
public class ScriptableObjectIdDrawer : PropertyDrawer
Inheritance
Methods
OnGUI(Rect, SerializedProperty, GUIContent)
Overrides the default GUI rendering for properties marked with ScriptableObjectIdAttribute. Automatically sets the property's string value to the asset's GUID if not already set, and renders it as a disabled (read-only) field in the Inspector.
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Parameters
| Name | Type | Description |
|---|---|---|
position | Rect | The rectangle on the screen to use for the property GUI. |
property | SerializedProperty | The serialized property to display. |
label | GUIContent | The label of the property. |