Search Unity

[2018.3.0f2][ArgumentException]when i extend RectTransformEditor ,i used refliction

Discussion in 'Immediate Mode GUI (IMGUI)' started by heng32032, Dec 25, 2018.

  1. heng32032

    heng32032

    Joined:
    Mar 22, 2018
    Posts:
    2
    when i extend RectTransformEditor,the Editor throw a lot of error like this; i used refliction

    ArgumentException: Object at index 0 is null
    UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs, UnityEngine.Object context) (at /Users/builduser/buildslave/unity/build/Editor/Mono/SerializedObject.bindings.cs:39)
    UnityEditor.Editor.GetSerializedObjectInternal () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:525)
    UnityEditor.Editor.get_serializedObject () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:432)
    UnityEditor.RectTransformEditor.OnEnable () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/RectTransformEditor.cs:100)
     
  2. pdinklag

    pdinklag

    Joined:
    Jan 24, 2017
    Posts:
    154
    I've seen these a few times lately in 2018.3 in my custom editor windows, I believe it happens after re-compiling editor code while an instance is open.

    In any event, it looks like a bug to me that can be ignored, at least I couldn't find anything wrong. If an Editor's serializedObject is bad during OnEnable, I'm not sure that's something we can fix anyway?
     
  3. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    Yeah, I have the same problem.
    I made an editor extension grouping a bunch of built-in components editors together in a single editor with tabs; unfortunately, this sometimes happens (after recompiling, as @pdinklag mentioned).

    I didn't run into any problem (such as the Animator not playing, collision detection being disabled etc.), either; however, it keeps spamming these errors in large quantities after each compilation and changing playmode state – until the Editor is restarted. So it's mostly annoying rather than causing genuine trouble.

    Did you report it as a bug? I could only find something similar marked as "Won't Fix" without an explanation here, but hopefully, that's only related to that specific issue, not the whole "recompile with a custom Editor still open" problem.
     
  4. heng32032

    heng32032

    Joined:
    Mar 22, 2018
    Posts:
    2
    yeah, I have post bug reporter to Unity,
     
    schinkowski and Rallix like this.
  5. aemobile_zq

    aemobile_zq

    Joined:
    Mar 29, 2016
    Posts:
    6
    It seems that this bug has not been fixed yet.
     
  6. Fugo_Games

    Fugo_Games

    Joined:
    Jun 3, 2016
    Posts:
    1
    If you use Editor.CreateCachedEditor method while creating your 'static' editor instance (instead of Editor.CreateEditor for a non-static editor), these exceptions disappear, (Keep DestroyImmediate)
     
  7. Rallix

    Rallix

    Joined:
    Mar 17, 2016
    Posts:
    139
    Nope. CreateCachedEditor is what I always used and these exceptions are there.