Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  5. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

[SOLVED] Unity Window : ArgumentException: Object at index 0 is null

Discussion in '2019.2 Beta' started by Quatum1000, Jun 19, 2019.

  1. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    886
    Hi, I got this error for any unknown reason after about 10 times go into play mode in Editor.
    Error then repeat every time when go into play mode.

    Does also happen in 2019.1.7f1.

    Untitled-1.jpg

    ArgumentException: Object at index 0 is null
    UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs, UnityEngine.Object context) (at C:/buildslave/unity/build/Editor/Mono/SerializedObject.bindings.cs:39)
    UnityEditor.Editor.GetSerializedObjectInternal () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:553)
    UnityEditor.Editor.get_serializedObject () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:452)
    UnityEditor.UIElements.InspectorElement..ctor (UnityEditor.Editor editor, UnityEditor.UIElements.InspectorElement+Mode mode) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:133)
    UnityEditor.UIElements.EditorElement.Init () (at C:/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:86)
    UnityEditor.UIElements.EditorElement..ctor (System.Int32 editorIndex, UnityEditor.InspectorWindow iw) (at C:/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:64)
    UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1392)
    UnityEditor.InspectorWindow.RebuildContentsContainers () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:639)
    UnityEditor.InspectorWindow.RedrawFromNative () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:311)
     
    Luis-Sibrian and Michael_Berna like this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,022
    Could you please submit a bug report for it, if possible with a reproduction project and then reply in here with the issue ID?
     
    alline_mi likes this.
  3. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    886
    It seems the error comes up if a second inspector window is open.
     
  4. Tomas225

    Tomas225

    Joined:
    Jun 9, 2018
    Posts:
    1
    This helped me a lot, worked for me but you have to restart unity.
     
  5. happyrobotstudio

    happyrobotstudio

    Joined:
    Apr 13, 2019
    Posts:
    14
    Wow yes. Very handy. After restarting, and removing the second inspector window, the mystery error goes away. Thanks thanks.
     
  6. geraldp48

    geraldp48

    Joined:
    Jul 30, 2018
    Posts:
    22
    I am also getting this same error but I do not have a second inspector window open.
     
    SwixDevs and I_n0sc0p3d_JFK like this.
  7. 40detectives

    40detectives

    Joined:
    Apr 9, 2016
    Posts:
    74
    Wow, I was quite uneasy because I'm in a hutty and it popped me after being playing with serialiazing some json, and first thought was I messed something up.

    But it was just the second inspector tab. Big thanks to @Quatum1000
     
  8. Ludiq

    Ludiq

    Joined:
    Mar 6, 2015
    Posts:
    750
    I could swear I had seen an open bug report for this but I can't find it anymore.

    Is it somewhere in the issue tracker @LeonhardP ?

    Also, it seems to happen if you create a GameObject editor from script.
     
    Nexer8 and Michael_Berna like this.
  9. Bobby_F

    Bobby_F

    Joined:
    May 24, 2011
    Posts:
    9
    We're getting a similar error after working on customised timeline signals:

    SerializedObjectNotCreatableException: Object at index 0 is null
    UnityEditor.Editor.CreateSerializedObject () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:577)
    UnityEditor.Editor.GetSerializedObjectInternal () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:554)
    UnityEditor.Editor.get_serializedObject () (at C:/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:453)
    UnityEditor.Timeline.Signals.SignalReceiverInspector.OnEnable () (at C:/Program Files/Unity/Hub/Editor/2019.2.17f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.timeline/Editor/Signals/SignalReceiverInspector.cs:28)

    The error doesn't appear in 2019.2.6f1 but does after porting the content to a project using the latest Unity 2019.2.17f1.
    We don't have two Inspector windows open as discussed above. I've tried closing the inspector panel and closing the timeline panel but this doesn't fix things.

    I've attached our SignalReceiverWithInt class which may be the source of the problem. Perhaps the serialization tags need tweaked?

    Thanks for any input.
     

    Attached Files:

    Roman_34 and Menion-Leah like this.
  10. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    182
    I'm also getting this error. In my case I have a custom node graph implementation using UIElements, and the graph is represented as a prefab with a bunch of child gameObjects as nodes. It is always accompanied by this other exception:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.GameObjectInspector.ClearPreviewCache () (at <83a73882c51c4602b3d34743827d03e7>:0)
    UnityEditor.GameObjectInspector.OnDisable () (at <83a73882c51c4602b3d34743827d03e7>:0)
     
  11. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    I just updated to 2018.4.16f1 and this started appearing when I have Squiggle open when entering playmode. Yay.
     
  12. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    886
    Seem the issue happen if a editor window access an existing window and try to share it's instance. From 2019.2 it never appears again to me.
     
  13. bamncan

    bamncan

    Joined:
    Dec 15, 2013
    Posts:
    46
    It happens to me if I have a game object that has a code script as a component (and therefore inspecting) when I hit Play on v2019.2.0f1.
     
    Last edited: Feb 9, 2020
  14. mcrabbs

    mcrabbs

    Joined:
    May 5, 2015
    Posts:
    2
    Yes, closing the second inspector window SOLVED this for me as well.

    Still, there is a bug for those of you developing the tool.