Failed to load CustomEditor inspected type

Issue #65 resolved
Maddo Science created an issue
  • What happened? I'm getting the following error whenever scripts recompile:
#!

[Error] Failed to load CustomEditor inspected type
Sirenix.Utilities.MemberInfoExtensions.GetAttributes()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.Utilities/Extensions/MemberInfoExtensions.cs:72

Sirenix.Utilities.MemberInfoExtensions.GetAttribute()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.Utilities/Extensions/MemberInfoExtensions.cs:43

Sirenix.Utilities.MemberInfoExtensions.GetAttribute()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.Utilities/Extensions/MemberInfoExtensions.cs:53

Sirenix.OdinInspector.Editor.InspectorTypeDrawingConfig.GetEditorDrawnType()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Config/InspectorTypeDrawingConfig.cs:362

Sirenix.OdinInspector.Editor.<>c__DisplayClass9_0.<.cctor>b__1()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Config/InspectorTypeDrawingConfigDrawer.cs:303

Sirenix.Utilities.LinqExtensions.ForEach()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.Utilities/Extensions/LinqExtensions.cs:42

Sirenix.OdinInspector.Editor.InspectorTypeDrawingConfigDrawer..cctor()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Config/InspectorTypeDrawingConfigDrawer.cs:299

Sirenix.OdinInspector.Editor.EditorCompilation.RecompileAsSoonAsPossibleIfEditorsChanged()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/EditorCompilation.cs:266

Sirenix.OdinInspector.Editor.EditorCompilation.RecompileAsSoonAsPossibleIfEditorsChanged()    C:/Users/Bjarke/Desktop/Projects/Sirenix Development Framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/EditorCompilation.cs:240

UnityEditor.EditorApplication.Internal_CallUpdateFunctions()
  • How we can reproduce it?

I don't know why it started happening. I started using "Handles" in code but even if I try to undo what I last did this still happens

  • What version of Unity are you using?

5.6.0f3

  • What version of Odin are you using?

1.0.0.2 and 1.0.0.3

Comments (10)

  1. Tor Esa Vestergaard

    I think I know what's causing this error. Out of curiosity, does it go away if you go into the preferences and trigger an editor recompile?

    Either way, the error message itself should be perfectly harmless, though I'll make a note of making it go away.

  2. Maddo Science reporter

    If I recompile the error stays, I tried to disable as much stuff as possible in the preferences but it still shows up, really weird

  3. Maddo Science reporter

    Also this error blocks play mode, even though it can be unpaused it's still annoying to do so

  4. Tor Esa Vestergaard

    It seems you have a custom editor somewhere that either has a null argument, or if it's in an assembly in your project, a reference to a type that no longer exists.

    All Odin does in this case is ask for the [CustomEditor] attribute and Unity, being annoying, logging an error in the constructor of that attribute instance because the type argument is null.

    This is not going to be happening on an Odin editor, as doing an editor recompile does not fix it. Somewhere else there is a faulty custom editor causing this.

    There's going to be some cases where this error cannot be fixed (when a null argument is actually passed to the attribute), but for other cases we can fix it with some type resolution emit hackery.

    Meanwhile, you can try and track down which custom editor in your project might be causing this to happen.

  5. Maddo Science reporter

    Turns out that it was one of my own dlls that did it, specifically an editor one containing custom editors. I had to try them all one by one but in the end I managed to narrow it to this one:

    [CustomEditor(typeof(Line))]
        public class LineInspector : UnityEditor.Editor
        {
            private void OnSceneGUI()
            {
                Line line = target as Line;
    
                Transform handleTransform = line.transform;
                Quaternion handleRotation = UnityEditor.Tools.pivotRotation == PivotRotation.Local ?
                    handleTransform.rotation : Quaternion.identity;
                Vector3 p0 = handleTransform.TransformPoint(line.Point0);
                Vector3 p1 = handleTransform.TransformPoint(line.Point1);
    
                Handles.color = Color.white;
                Handles.DrawLine(p0, p1);
                EditorGUI.BeginChangeCheck();
                p0 = Handles.DoPositionHandle(p0, handleRotation);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(line, "Move Point");
                    EditorUtility.SetDirty(line);
                    line.Point0 = handleTransform.InverseTransformPoint(p0);
                }
                EditorGUI.BeginChangeCheck();
                p1 = Handles.DoPositionHandle(p1, handleRotation);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(line, "Move Point");
                    EditorUtility.SetDirty(line);
                    line.Point0 = handleTransform.InverseTransformPoint(p1);
                }
            }
        }
    

    This is really weird because I got the code from this tutorial: [http://catlikecoding.com/unity/tutorials/curves-and-splines/

    ](Tutorial)

    After disabling that specific editor script the error stops occurring, which is weird because I don't see anything weird about it, other than maybe the fact it might be outdated

  6. Tor Esa Vestergaard

    Ah, I see. I've looked around fixed all the slashes - it should work in the next patch after 1.0.0.3a.

  7. Log in to comment