That issue has started for me recently as well. That error repeats continuously any time I save my scripts, or when I start game testing. It continues after I stop the game. It looks like it’s happening whenever I’m viewing the inspector on my main canvas which has most of my main scripts attached to it. When I click on another object it stops, then I can go back to my main canvas. After saving or starting the game the issue starts again. It first prints this error:
ArgumentNullException: Value cannot be null.
Parameter name: _unity_self
UnityEditor.UIElements.Bindings.SerializedObjectList.get_Count () (at /Users/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Editor/Bindings/ListViewBindings.cs:453)
I don’t find any solution yet. Unity should do it. And I am using newest(2.21) version, but it seems not so much occurs now, but can’t sure why. I did [spiney199]'s method above, maybe cus of this.
In my project Unity’s Version Control has never been included.
Error happens literally after each Play Mode enter and exit if object with several custom editors selected.
In editor mode it disappearing only after scripts recompilation.
In enter play mode it stops after new scene loaded and I change selection in inspector.
I updated to 2022 LTS (currently version 2022.3.7f1) from 2021 LTS today and ran into this issue. I was able to track it down and reproduce it. It’s possible there are multiple causes, but for me it occurs when you exit play mode while the inspector is displaying a list whose contents are generated at runtime. The list has to be in the expanded state when exiting play mode for it to occur, if it is collapsed, the error won’t occur. I noticed that it requires two such lists to be in the inspector (only one of which needs to be open) to result in the infinitely repeating error message. If you only have one such list, it will display the error message only once.
To workaround the issue, you can collapse any such lists in the inspector or select an item in the hierarchy that does not cause any such lists to be displayed in the inspector before exiting play mode. If you forget to do this and the infinitely scrolling error message occurs, you can select another item in the hierarchy that doesn’t display such a list and then enter and exit play mode again and it should stop.
I typed up and sent in a bug report, so hopefully it will be addressed in a future update.
I haven’t found a proper solution yet, but I have tracked down what causes the issue for me.
I have some prefabs in the scene which inherits from a shared abstract class, which has several [SerializeField] variables.
If I click Play In Editor and then have one of those prefabs selected in the hierarchy when I stop playing, then the error happens. If I do not have any of those prefabs selected when I stop playing, then the issue goes away.
So whatever is happening, I guess, is that the inspector does not have enough time to initialize one or more of the fields on the prefab if it is highlighted during the inspector refresh (possibly due to those fields being part of an abstract class?). Seems like some weird GUI execution order issue.
I’ve just started getting this error when I try to add items to a SerializeField list in the inspector. When I click the plus sign to add an element, I get the error and the whole list disappears from the inspector. Clicking Undo brings it back, but it takes many attempts of clicking plus and undo until I get the number of fields I want. Once I have the fields, I can drag assets into them with no further issue, and everything seems to work properly in Play mode. The error in the console is like 50 lines long, pointing to various UnityEditor.UIElements… things.
This only started happening since upgrading from 2022.3.9 to 2022.3.10 the other day.
Thanks! I was doing the same–I don’t initialize it in Awake or Start because I want to populate the list in the inspector. Anyway, I tried changing the format to ‘public List someList;’ (without the ‘= new List’ part) and that seems to work just as well, so hopefully that clears up the error.
I had the similar error.
I thought it was happening because I started to use play mode save asset.
In fact, it’s related to that asset. I instantiate prefabs in the play mode and then exit. When I exit, it instantiates prefabs in the edit mode. I guess it happens too quickly that unity doesn’t have time to set its values.
My workaound is, when exiting play mode, not to keep prefabs generated at runtime selected. If inspector doesn’t show object properties, it doesn’t throw error in edit mode.
It took me understand a good amount of time.
I wish I looked here way before