From fedf0a891d0abafb37b5f37a991a81d52e4e9694 Mon Sep 17 00:00:00 2001 From: uurha Date: Sun, 1 Sep 2024 21:27:43 +0200 Subject: [PATCH 1/2] Update MultiEditor --- .../Editor/CustomEditors/MultiEditor.cs | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) 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) From 31f0fec12d156dc96a7955c03e46a5fdb37ab589 Mon Sep 17 00:00:00 2001 From: uurha Date: Sun, 1 Sep 2024 21:27:54 +0200 Subject: [PATCH 2/2] Update package.json --- Assets/BetterCommons/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": {