Search Issue Tracker
Fixed in 2019.1.X
Fixed in 2019.2.X
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
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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
code-blep
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.
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)
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.
YYZ291
May 03, 2019 01:31
To add on, the error always appears for me when I enter Play Mode with a GameObject selected that is attached with a script. This part is at least deterministic for me.
If I do not select any game object, the error doesn't appear.
If I select an empty game object (no scripts on it), the error doesn't appear.
Closing the second inspector window removes the error completely, but I always use two inspector windows - one normal mode, one on debug mode that I switch to for debugging. Hope this gets resolved!
Hope this helps out Unity and other developers.
The5
Apr 30, 2019 18:51
Just had this happen in 2019.1 and 2019.2.
The behavior appears non-deterministic as it just happens occasionally.
Closing the 2nd inspector resolved the issue.