From 0174b71bccc2cb7cb53977d5cd868722fb026408 Mon Sep 17 00:00:00 2001 From: bd_ Date: Thu, 9 Nov 2023 14:46:32 +0900 Subject: [PATCH] fix(unity2022): inspector is broken on 2022 (#518) --- Editor/Inspector/MAEditorBase.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Editor/Inspector/MAEditorBase.cs b/Editor/Inspector/MAEditorBase.cs index ead453d0..e72b78ba 100644 --- a/Editor/Inspector/MAEditorBase.cs +++ b/Editor/Inspector/MAEditorBase.cs @@ -44,9 +44,12 @@ namespace nadena.dev.modular_avatar.core.editor if (innerIsImgui) { var throwaway = new InspectorElement(); - MethodInfo m = typeof(InspectorElement).GetMethod("CreateIMGUIInspectorFromEditor", - BindingFlags.NonPublic | BindingFlags.Instance); - inner = m.Invoke(throwaway, new object[] {serializedObject, this, false}) as VisualElement; + inner = typeof(InspectorElement).GetMethod("CreateIMGUIInspectorFromEditor", + BindingFlags.NonPublic | BindingFlags.Instance) + ?.Invoke(throwaway, new object[] {serializedObject, this, false}) as VisualElement + ?? typeof(InspectorElement).GetMethod("CreateInspectorElementUsingIMGUI", + BindingFlags.NonPublic | BindingFlags.Instance) + ?.Invoke(throwaway, new object[] { this }) as VisualElement; } _visualElement.Add(inner);