I currently see crashes when starting my game, which lead to a Unity crash when stopping and then starting the game again:
InvalidOperationException: System.InvalidOperationException: Unable to create a SharedStatic for this key. This is most likely due to the size of the struct inside of the SharedStatic having changed or the same key being reused for differently sized values. To fix this the editor needs to be restarted.
SharedStatic_1: all package dependencies, how it happens, etc. (Murphyās Law: at the end of the video, I try to restart the game multiple times, and it doesnāt crash ā¦ usually it crashes with the 2nd start)
SharedStatic_2_UnityCrash: Unity crashes (usually with the 2nd start of the game, when the InvalidOperationException has already happened once)
SharedStatic_Errors.txt: all errors + the Unity crash log
Does this happen every time, or only after you have e.g. changed some package manager dependencies or similar? The error message says that it can be resolved by restarting the editor. Does it happen repeatedly even after restarting the editor?
It happens every time I start the gameā¦ the crash then āusuallyā happens on the 2nd start.
I noticed some other errors since A* version 4.3.59 or so, which lead to crashes after playing the game for a whileā¦ it always included some Burst compiler error messages.
Since 4.3.61, it behaves like I described above.
I tried out to use exactly the dependencies A* needs, but that didnāt make things better
So currently I am sticking with what Unity suggests as the most up-to-date versions.
Currently itās Unity 2022.2.1f1 ā¦ I try to stay up to date with the latest version, since I am still far from a releasable game, and can afford some errors here and there
Hmm. Iām using 2022.2.0b16 so that should be very close to what you are using.
My package only uses a shared static in a single place, and thatās a global static variable in DrawingData.cs. The value is also a single float which always has a fixed size.
This seems like a unity bug to me.
Then I will go with A* 4.3.58 for the moment, cause it doesnāt crash Unityā¦ will check the current A* version out with the upcoming Unity versions, and give you feedback then
I just upgraded from Unity 2021 to 2022 and this exact same thing is happening to me. The first time I run it I see the errors mentioned, then next time I run it, it crashes Unity.
Unity Version: 2022.2.7f1
A*: 4.3.61
Iāve downgraded to version 4.3.58 which does not crash.
The Unity editor restarts itself when it crashes, lol. I did this about 6 times before I found this thread and rolled back. I can try again to upgrade to the latest version, but Iām not sure restarting the editor is going to solve it.
I wanted to observe it a little bit longer butā¦ with the newest Unity 2022.2.x versions, 4.3.61 āseemsā to be running.
I still had some crashes during runtime, not sure which 2022.2.x version. Not sure if it is related ā¦ but up until now, the only crashes that ābadā were related to A* (no complains! no offense! I guess itās just related to Burst not having much of a stacktrace, or debug/log info, which makes it hard to find errors and their causes ā¦ and Unity still developing that stuff)