diff --git a/Assets/BetterCommons/Editor/CustomEditors/MultiEditor.cs b/Assets/BetterCommons/Editor/CustomEditors/MultiEditor.cs index 5138238..bf18a88 100644 --- a/Assets/BetterCommons/Editor/CustomEditors/MultiEditor.cs +++ b/Assets/BetterCommons/Editor/CustomEditors/MultiEditor.cs @@ -99,35 +99,41 @@ protected void SetOverrideDefault(bool value) public override VisualElement CreateInspectorGUI() { - var m = Editor.CreateInstance(); - m.SetOverrideDefault(false); var container = new VisualElement(); - for (var i = 0; i < _preEditors.Count; i++) - { - var element = _preEditors[i].CreateInspectorGUI(); - if (element != null) - { - container.Add(element); - } - } + IteratePreEditors(container); if (!_overrideDefault) { InspectorElement.FillDefaultInspector(container, serializedObject, this); } - for (var i = 0; i < _postEditors.Count; i++) + IteratePostEditors(container); + + container.TrackSerializedObjectValue(serializedObject, OnSerializedObjectTrack); + return container; + } + + protected void IteratePreEditors(VisualElement container) + { + IterateEditors(_preEditors, container); + } + + protected void IteratePostEditors(VisualElement container) + { + IterateEditors(_postEditors, container); + } + + private void IterateEditors(List extendedEditors, VisualElement container) + { + for (var i = 0; i < extendedEditors.Count; i++) { - var element = _postEditors[i].CreateInspectorGUI(); + var element = extendedEditors[i].CreateInspectorGUI(); if (element != null) { container.Add(element); } } - - container.TrackSerializedObjectValue(serializedObject, OnSerializedObjectTrack); - return container; } protected virtual void OnSerializedObjectTrack(SerializedObject serializedObject) diff --git a/Assets/BetterCommons/package.json b/Assets/BetterCommons/package.json index 1324a03..98baf75 100644 --- a/Assets/BetterCommons/package.json +++ b/Assets/BetterCommons/package.json @@ -1,7 +1,7 @@ { "name": "com.tdw.better.commons", "displayName": "Better Commons", - "version": "0.0.47", + "version": "0.0.48", "unity": "2021.3", "description": " ", "dependencies": {