Static Inspector failing to work with this code

Issue #708 open
Mehmet Can Kahraman created an issue

The reason it fails is that some properties check other properties to return the value. I think that's triggering the bug. Please view the attached file.

For example, the property VeryHighOrMore checks the property Ultra. This is done to simplify the code.

Here is the console log, this and similar errors appear 5 times every frame when Static Inspector is open.

NotImplementedException: The method or operation is not implemented.
System.Reflection.MethodInfo.get_ReturnParameter () (at <9577ac7a62ef43179789031239ba8798>:0)
Sirenix.OdinInspector.Editor.ButtonParameterPropertyResolver.Initialize () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Resolvers/Property Resolvers/ButtonParameterPropertyResolver.cs:72)
Sirenix.OdinInspector.Editor.OdinPropertyResolver.Create (System.Type resolverType, Sirenix.OdinInspector.Editor.InspectorProperty property) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Resolvers/Property Resolvers/OdinPropertyResolver.cs:59)
Sirenix.OdinInspector.Editor.DefaultOdinPropertyResolverLocator.GetResolver (Sirenix.OdinInspector.Editor.InspectorProperty property) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Resolvers/Locators/DefaultOdinPropertyResolverLocator.cs:170)
Sirenix.OdinInspector.Editor.InspectorProperty.Create (Sirenix.OdinInspector.Editor.PropertyTree tree, Sirenix.OdinInspector.Editor.InspectorProperty parent, Sirenix.OdinInspector.Editor.InspectorPropertyInfo info, System.Int32 index, System.Boolean isRoot) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/InspectorProperty.cs:1394)
Sirenix.OdinInspector.Editor.PropertyChildren.Get (System.Int32 index) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyChildren.cs:204)
Sirenix.OdinInspector.Editor.PropertyChildren.get_Item (System.Int32 index) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyChildren.cs:42)
Sirenix.OdinInspector.Editor.PropertyTree`1+<EnumerateTree>d__66[T].MoveNext () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:1960)
Sirenix.OdinInspector.Editor.StaticInspectorWindow.DrawTree () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Windows/StaticInspectorWindow.cs:322)
Sirenix.OdinInspector.Editor.StaticInspectorWindow.DrawEditor (System.Int32 index) (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Windows/StaticInspectorWindow.cs:252)
Sirenix.OdinInspector.Editor.OdinEditorWindow.DrawEditors () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:710)
Sirenix.OdinInspector.Editor.OdinEditorWindow.OnGUI () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinEditorWindow/OdinEditorWindow.cs:644)
Sirenix.OdinInspector.Editor.StaticInspectorWindow.OnGUI () (at X:/Repositories/sirenix-development/Sirenix Solution/Sirenix.OdinInspector.Editor/Windows/StaticInspectorWindow.cs:177)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEditor.DockArea.OldOnGUI () (at <e6e2fa0a47414cd2ac33237924761b45>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <356f1ddb1d524ad59c7a2c95775bb38e>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity 2019.4.12f1

Comments (3)

  1. Mehmet Can Kahraman reporter

    I just noticed that this bug isn’t related to properties checking each other.

    This simplified version also fails.

    using UnityEngine;
    using Sirenix.OdinInspector;
    
    public  class GraphicsLevel : MonoBehaviour 
    {
        public enum DokuzKademeGrafikVeOff { Highest = 0, UltraHigh = 1 };
        public static bool Highest(DokuzKademeGrafikVeOff grafik) => grafik == DokuzKademeGrafikVeOff.Highest;
    
        public static bool UltraHigh(DokuzKademeGrafikVeOff grafik) => grafik == DokuzKademeGrafikVeOff.UltraHigh;
    
    
    
        [Button("Inspect This Class"), GUIColor(0.4f, 0.8f, 1f)]
        void InspectThisClass()
        {
            Sirenix.OdinInspector.Editor.StaticInspectorWindow.InspectType(typeof(GraphicsLevel));
        }
    }
    

    If I comment out one of the properties (UltraHigh or Highest) it doesn’t fail anymore.

  2. Log in to comment