I'm getting several errors from Unity's Selectable.cs and TextMeshProUGUI.cs, like null reference exceptions and index out of range, but only every third time I hit the play button. Like it will run fine twice, then the third time it will give a bunch of errors, and it does this with perfect consistency. I've been doing a lot of UI work with instantiating prefabs, and it started happening after some small change to the UI (like adjusting colors, transform hierarchy, etc. im not exactly sure when it started). This is one of the 26 errors:
IndexOutOfRangeException: Index was outside the bounds of the array.
UnityEngine.UI.Selectable.OnDisable () (at Library/PackageCache/[email protected]/Runtime/UI/Core/Selectable.cs:560)
#Getting an error every 3rd time I play the game
1 messages · Page 1 of 1 (latest)
Hey! Since this works twice, may have some information or setting missed by your play button code. How the play button code looks like?
its not my play button, im referring to the Unity editor play button that starts your game
Oh, my bad. So what's the unity version you're using?
all good, i appreciate the help. im using 2021.3.10f1
Ok, i don't think the version is related to this problem, it is a final version. Does those 26 errors are always the same or they change sometimes?
I ended up finding the issue - the font I was using on a textmeshpro buton didn't have a space character, so it was generating a submesh for it. once I removed the space character, the errors stopped. I have no idea why, but they stopped.