Skip to main content

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​

NameTypeDescription
positionRectThe rectangle on the screen to use for the property GUI.
propertySerializedPropertyThe serialized property to display.
labelGUIContentThe label of the property.
  • Methods
    • OnGUI(Rect, SerializedProperty, GUIContent)