Skip to content

Commit

Permalink
Add virtual OnGUI methods for different sections
Browse files Browse the repository at this point in the history
  • Loading branch information
Varneon committed May 3, 2023
1 parent 9bdf797 commit 4bf1629
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Packages/com.varneon.vudon.editors/Editor/InspectorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,29 @@ protected virtual void OnEnable()
}
}

/// <summary>
/// Gets called before the inspector draws all of the default fields
/// </summary>
protected virtual void OnPreDrawFields() { }

/// <summary>
/// Gets called after the inspector is one drawing all of the default fields
/// </summary>
protected virtual void OnPostDrawFields() { }

/// <summary>
/// Gets called after the inspector has drawn the default footer
/// </summary>
protected virtual void OnPostDrawFooter() { }

public sealed override void OnInspectorGUI()
{
header.Draw(editorDarkMode);

serializedObject.Update();

OnPreDrawFields();

for (int g = 0; g < propertyGroups.Count; g++)
{
ISerializedPropertyGroup group = propertyGroups.ElementAt(g);
Expand Down Expand Up @@ -170,7 +187,11 @@ public sealed override void OnInspectorGUI()
}
}

OnPostDrawFields();

if (drawFooter) { DrawInspectorFooter(); }

OnPostDrawFooter();
}

private void DrawInspectorFooter()
Expand Down

0 comments on commit 4bf1629

Please sign in to comment.