ArgumentNullException: Value cannot be null. Parameter name: _unity_self

I am making 2d game using newest unity, 2022.2.17f1

Now I met this error and this does not indicate any of my code’s location, so can’t know what is cause, can’t debug, find any solution at googling.

Please help, this is error message at console.


ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEditor.UIElements.Bindings.SerializedObjectList.get_Count () (at <68890c016c7a40d7ab0d5ba9aecf643f>:0)
UnityEngine.UIElements.VerticalVirtualizationController1[T].get_itemsCount () (at <6350d5f72ec34638985fbaab06c4c559>:0) UnityEngine.UIElements.DynamicHeightVirtualizationController1[T].IsIndexOutOfBounds (System.Int32 i) (at <6350d5f72ec34638985fbaab06c4c559>:0)
UnityEngine.UIElements.DynamicHeightVirtualizationController1[T].CleanItemHeightCache () (at <6350d5f72ec34638985fbaab06c4c559>:0) UnityEngine.UIElements.DynamicHeightVirtualizationController1[T].Refresh (System.Boolean rebuild) (at <6350d5f72ec34638985fbaab06c4c559>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.RefreshItems () (at <6350d5f72ec34638985fbaab06c4c559>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at <6350d5f72ec34638985fbaab06c4c559>:0)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)

4 Likes

I haven’t seen that specific error before, but usually when I get an untraceable error it’s because of some corrupted object in the scene.

I would make a copy of your current project. In the copy, continually delete objects and refresh the console until the error goes away. Once the error goes away, then you know that the object that you deleted must have the error.

There could also be a problem with the scene itself. I’ve also seen errors where an object in my scene seemed perfectly fine, but that object’s prefab was corrupted.

2 Likes

What currupted means? hm… I don’t know why I should do that cuz it seems unity internal error.

1 Like

Some kind of bug in Unity caused an asset or scene object to become invalid data. Usually you can fix it by deleting the object and recreating it. Upgrading Unity versions is common source of these errors, but did you upgrade an existing project or did you begin your project in 2022.2.17f1? Even still, I find that the prefab workflow is complicated now, and I think they’re still tweaking it, so it’s a common source of errors for me.

I cannot say for certain whether this is that cause of the error in your case. I was only suggesting that as something you could explore.

That’s almost certainly the root cause. If you can reproduce the problem reliably then you can file a bug report and hope they fix it.

Unless you have source access and a lot of free time, there’s no way to fix it. The only thing we can do is mitigate the consequences.

Thx, I am follower so I every time upgraded when new version come out. Wasn’t experienced this phenomenon at previous versions.

I have this same issue; I am using 2022.2.17f1; does it only happen when you hit play when some objects are selected in the inspector and have a script on them?

30 Likes

Didn’t knew this. But I tested just now, yes it seems you are right.

So now what is cause and how to resolve…

4 Likes

Might stem from the same issue that I had. When I changed values in a script on my prefabs they bugged out and all their references broke. This means that if you edit a prefab you have to re-reference that prefab in the editor to every single script every time. I had to roll back to LTS 2021 cause of it. It also threw me several other errors about Workers and Jobs.

Yes, I’m experiencing the same thing. I can literally have an empty script on an otherwise empty GameObject with one field and I’ll get this error on play start. Script:

using UnityEngine;

public class Test : MonoBehaviour {

    public int HelloWorld = 2;

}

Interestingly, removing the field prevents the error (though that’s obviously no workaround).

EDIT: Updating to 2022.2.18f1 fixed it.

1 Like

I am experiencing the same issue with 2022.2.21

I have this issue on 2022.3.3f1. It’s pretty annoying. I started a fresh project and pulled over objects from my old 2019.3.11f project. If I select my gameobject, that I’m using as a singleton to track the game state, and hit “Play”. I get the same error:

ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEditor.SerializedObject.FindProperty (System.String propertyPath) (at /Users/bokken/build/output/unity/unity/Editor/Mono/SerializedObject.bindings.cs:74)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindPropertyRelative (UnityEngine.UIElements.IBindable field, UnityEditor.SerializedProperty parentProperty) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:169)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:113)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:39)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation+BindingRequest.Bind (UnityEngine.UIElements.VisualElement element) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/BindingExtensions.cs:1126)
UnityEngine.UIElements.VisualTreeBindingsUpdater.Update () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Bindings/VisualTreeBindingsUpdater.cs:272)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/VisualTreeUpdater.cs:111)
UnityEngine.UIElements.Panel.UpdateBindings () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/Panel.cs:1002)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:256)
UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/UIElementsUtility.cs:105)
UnityEditor.RetainedMode.UpdateSchedulers () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/RetainedMode.cs:55)

However, if I don’t have that object selected, I can hit “Play” and it runs fine. I’m not sure if this is a bug with the latest unity or in my code, but this code has been working in my Unity2019 project for years.

6 Likes

Pretty sure this is a bug from the newest Unity. I also never have seen this bug before, until I just upgraded to 2022.3.3f1, and there’s been no remarkable new changes to my project. I noticed these errors come and go, so sometimes they don’t show for a while, then they come back.

1 Like

Can confirm that this was the case for me but would also add that disabling objects helped to find the issue too, didn’t have to delete them.

In my case restarting a project helped remove the errors but they always came back after a while. Using Unity 2022.3.3f1.

Actually, this is 100% true for me. Errors appear when I select an object before launching the scene. Strange things lurk ahead.

1 Like

I’m experiencing this issue intermittently as well. Wish I knew how to reproduce it, but all advice on attempting to reproduce and/or fix it have thus far failed. I’m not going down a list of 100s of items disabling/re-enabling things when I can’t even faithfully reproduce the problem.

ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEditor.UIElements.Bindings.SerializedObjectList.get_Count () (at <9f0f853070524c139e10a85a1cfcedb6>:0)
UnityEngine.UIElements.VerticalVirtualizationController`1[T].get_itemsCount () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.DynamicHeightVirtualizationController`1[T].IsIndexOutOfBounds (System.Int32 i) (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.DynamicHeightVirtualizationController`1[T].CleanItemHeightCache () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.DynamicHeightVirtualizationController`1[T].Refresh (System.Boolean rebuild) (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.RefreshItems () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.BaseVerticalCollectionView.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Seems to happen when a GameObject with a script is selected (as another user suggested). I also noticed (might be a coincidence) that the number of error messages given after pressing play was the same number of [SerializedField]'s that the particular selected GameObject had under the Script component. Maybe "[SerializedField]'s is wrong but I mean all the places where you can edit stuff and drag and drop.

5 Likes

I’m getting the same errors on 2022.3. Seems to be related to [SerializeField] possibly or just serialized arrays. I started getting this when I switched the location of one of my arrays in the code. If I have the gameobject with the script selected then the error pops up on play, if not it runs as normal.

3 Likes

Having this show up out of no where every now and then, I have 2022.3.2f1 LTS, it goes away after a while by itself or when I restart the unity editor :

ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEditor.SerializedObject.FindProperty (System.String propertyPath) (at <ac87b54e58ee4be198261fd5c8030d52>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindPropertyRelative (UnityEngine.UIElements.IBindable field, UnityEditor.SerializedProperty parentProperty) (at <9f0f853070524c139e10a85a1cfcedb6>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <9f0f853070524c139e10a85a1cfcedb6>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.ContinueBinding (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <9f0f853070524c139e10a85a1cfcedb6>:0)
UnityEditor.UIElements.Bindings.DefaultSerializedObjectBindingImplementation+BindingRequest.Bind (UnityEngine.UIElements.VisualElement element) (at <9f0f853070524c139e10a85a1cfcedb6>:0)
UnityEngine.UIElements.VisualTreeBindingsUpdater.Update () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.Panel.UpdateBindings () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <735c071c072642ad8d077fa38c650a28>:0)
UnityEditor.RetainedMode.UpdateSchedulers () (at <9f0f853070524c139e10a85a1cfcedb6>:0)
1 Like

Yes, repro on 2022.3.0f1 while selecting an object with script in Hierarchy.
Work around: select none object in Hierarchy when pressing Play.

18 Likes

Same here, love Unity even more

great. thanks - solved the issue :slight_smile:

4 Likes