Search Issue Tracker

Fixed in 2019.1

Fixed in 2019.2

Votes

49

Found in

2018.3.11f1

2019.1.0b2

Issue ID

1147234

Regression

Yes

"ArgumentException: Object at index 0 is null" thrown when entering play mode with two Inspector windows and an attached script

Inspector Framework

-

How to reproduce:
1. Create a new project
2. Create a c# script and attach it to any object in the Hierarchy window
3. Add second Inspector window
4. Enter Play mode
5. Observe Console window

Expected result: no errors are thrown
Actual result: "ArgumentException: Object at index 0 is null" is thrown

Reproducible with: 2019.1.0b2, 2019.1.0f2, 2019.2.0a13, 2019.3.0a1
Not reproducible with: 2017.4.26f1, 2018.3.14f1, 2019.1.0b1

Comments (12)

  1. B5ef7e1804ee8476fd1a4edbf89cbe10?d=mm

    pryankster

    Jul 21, 2019 02:47

    Though I hate to add a "me, too" to this bug: I have noticed that I get the error when I have two inspectors open, and the FIRST inspector is showing (locked or unlocked) a GameObject with a script attached. No script? no error.

  2. 9746878fd170891307bb46706af297a8?d=mm

    MrLucid72

    Jul 15, 2019 14:57

    Still happens in Unity 2019.1.8f1, easily repro'd by the multiple mentions above ^

  3. 1cf02473f9789352ba965f44cc707b08?d=mm

    Adrian-Miasik

    Jul 15, 2019 00:31

    I've also managed to get this error on 2019.3.0a3 - Removing my second inspector window has prevented the error from showing up in the console and allows my editor scripts to execute properly.

  4. 9d4bd236d332dd88c5f1f215be52916e?d=mm

    Zahidylin_Marat

    Jul 09, 2019 05:58

    The same issue after upgrading project from Unity 2018 to 2019.1.9f1.

    Fix:
    I had 2 Inspector tabs open. If you close one the error should go away.

  5. D492be3777561a479e351d1c860f4eef?d=mm

    joonturbo

    Jul 05, 2019 17:05

    happens every time I hit play on 2019.1.8f1 on macOS

  6. 4073711f691e7b5952a438b672ccbc48?d=mm

    patsm00re18

    Jun 19, 2019 10:50

    If you are a fan of MOBA games, then Mobile Legends: Bang Bang is an unblocked game that you simply cannot miss! Engage in thrilling 5v5 battles and take down your opponent’s towers to claim the final victory! https://games.lol/mobile-legends-bang-bang/

  7. A8bcbac7e3e961b5269a6a6ceecee141?d=mm

    Blenderik

    Jun 17, 2019 12:51

    I only use one Editor and this exact error happens everytime I press play in all my projects since upgrade to 2019.

  8. F1bbbf82f5d3c362abeb6b39a192190a?d=mm

    Hexagon-Neuron

    May 10, 2019 15:12

    Also getting the same issue. Even on brand new projects. 2019.1 and 2019.2, only 1 inspector window open.

  9. 3df794d4b45e1aeb75480c98b27bd014?d=mm

    rightdroid

    May 03, 2019 07:35

    Can confirm on 2019.1.0f2.
    I use two inspector windows.

    What I observed is that it is always the second inspector window (in the order or creating the tabs) that throws the error when it has a gameobject with a script attached.

    To reproduce:
    1. close all inspector windows
    2. add first inspector window.
    3. select a gameobject that has a script attached
    4. press play.
    5. observe no errors. Exit playmode.
    6. create second inspector window
    7. press play.
    8. observe the error appearing.

    You can test by locking the second inspector window to a GO with a script and first one to a one without a script (and then switch) that it is the second inspector window that throws the error.

    Stacktrace is:
    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:84)
    UnityEditor.UIElements.EditorElement..ctor (System.Int32 editorIndex, UnityEditor.InspectorWindow iw) (at C:/buildslave/unity/build/Editor/Mono/Inspector/EditorElement.cs:62)
    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)

  10. B57a58e34b3b0fdc25016d0f29033b50?d=mm

    YYZ291

    May 03, 2019 01:37

    To continue from below:
    If you want to leave two inspector windows open, don't select any game object with scripts when entering Play Mode. This is a slight inconvenience to deselect any game object before hitting play mode, but once the editor is in Play Mode your game, you are free to select any game object and no error appears henceforth.

    It appears the error only occurs at the very moment PlayMode is started and you have a game object selected.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.