All of the below happens after a couple frames, every 100 or so runtimes.
A list that never has any items removed from it anywhere in any scripts is cleared.
Some seemingly random parts of scripts just stop executing.
And probably more, most of my game is just broken when this happens.
It does all of this without spewing out any errors.
I know this isn’t much to work with, but if you have any ideas please share.
I’m at a complete loss. I don’t even know what part of my code to share.
You will have to start investigating your code to find out what is happening, and perhaps share some code or pseudocode for help with specifics. Here are some general tips for debugging when there are no errors.
1: Use Debug.Log to check values, which will also include the call stack, which will tell you from where each particular part of the code is being called. Perhaps you have some rogue code calling in at some inopportune moment. Also Debug.Log irrelevant code, and variables that seem foolproof. You can never be too certain about what you missed. Figure out exactly what happens to your your list of items. Is it destroyed, recreated or simply emptied in some other way? Debug.Log will tell you.
2: Consider reducing complexity to simplify debugging. Reduced complexity might also help you regain full control of the programflow and information handling. Disable irrelevant functionality and focus on the parts of the code that seem relevant. Mind you, I’ve seen irrelevant code become relevant due to unforseen consequences…
3: Consider what random factors will lead to rare occations. Perhaps an object is passing over a zero position and suddenly NOT triggering that “if(pos.x > 0) else if(pos.x < 0)”. Perhaps your input at a specific time will start an unfortunate chain of events.
4: Desperate times will call for desperate actions. Disable large chunks of your code and focus on very specific parts of it only. If you are lucky, you will start reproducing the problem consistently.