Class ExtendedScriptableObjectDrawer
Extends how ScriptableObject object references are displayed in the inspector, showing all values under the object reference.
[CustomPropertyDrawer(typeof(ExpandableAttribute), true)]
public class ExtendedScriptableObjectDrawer : PropertyDrawer
Inheritance
Methods
CreatePropertyGUI(SerializedProperty)
Make custom UI Toolkit based GUI for the property.
public override VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
| Name | Type | Description |
|---|---|---|
property | SerializedProperty | The SerializedProperty to make the custom GUI for. |
Returns
VisualElement — The element containing the custom GUI.
DrawScriptableObjectField<T>(GUIContent, T, ref bool)
Draws a simplified ObjectField layout without foldout logic.
public static T DrawScriptableObjectField<T>(GUIContent label, T objectReferenceValue, ref bool isExpanded) where T : ScriptableObject
Parameters
| Name | Type | Description |
|---|---|---|
label | GUIContent | GUI label content. |
objectReferenceValue | T | The object reference to display. |
isExpanded | bool | Whether the content is expanded. |
Returns
T — The edited object reference.
Type Parameters
| Name | Type | Description |
|---|---|---|
T | Type of ScriptableObject. |
GetPropertyHeight(SerializedProperty, GUIContent)
Specify how tall the GUI for this field is in pixels.
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
Parameters
| Name | Type | Description |
|---|---|---|
property | SerializedProperty | The SerializedProperty to make the custom GUI for. |
label | GUIContent | The label of this property. |
Returns
float — The height in pixels.
OnGUI(Rect, SerializedProperty, GUIContent)
Make custom IMGUI based GUI for the property.
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. |
_GUILayout<T>(string, T, ref bool)
Creates a foldout-style ObjectField in IMGUI that expands child properties if available.
public static T _GUILayout<T>(string label, T objectReferenceValue, ref bool isExpanded) where T : ScriptableObject
Parameters
| Name | Type | Description |
|---|---|---|
label | string | Label for the foldout. |
objectReferenceValue | T | Reference to the ScriptableObject. |
isExpanded | bool | Whether the foldout is currently expanded. |
Returns
T — The edited object reference.
Type Parameters
| Name | Type | Description |
|---|---|---|
T | Type of ScriptableObject. |
_GUILayout<T>(GUIContent, T, ref bool)
Creates a foldout-style ObjectField in IMGUI that expands child properties if available.
public static T _GUILayout<T>(GUIContent label, T objectReferenceValue, ref bool isExpanded) where T : ScriptableObject
Parameters
| Name | Type | Description |
|---|---|---|
label | GUIContent | Label for the foldout. |
objectReferenceValue | T | Reference to the ScriptableObject. |
isExpanded | bool | Whether the foldout is currently expanded. |
Returns
T — The edited object reference.
Type Parameters
| Name | Type | Description |
|---|---|---|
T | Type of ScriptableObject. |