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.
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.
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?
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).
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:
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.
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.
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.
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.
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.
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 :