I'm encountering a very weird issue and I'm not sure where to start digging for reasons behind it. Any help would be appreciated. In short, what's happening is this: some of the panels in my application (it's a relatively simple 2D game built entirely with NGUI panels) disappear during prolonged play with no clear trigger or reason. Here is how one of the screens looks normally:
And here is how it looks once the glitch happens:
Unfortunately, over the course of the week in testing, I was only able to encounter the issue on iOS and Android devices and never in the editor, which severely complicates things as I'm unable to inspect the state of missing objects to figure out how they do it. My versions so far:
- Something is changing the depth of an UIPanel, hiding them behind the background (proved that unlikely by checking the glitch with a build with a transparent background - nothing was there)
- Something is changing the alpha of an UIPanel to 0, making it invisible
- Something is disabling or destroying a GameObject housing a UIPanel (might be likely, as one of the managers hangs if the glitch happens during interaction with one of the plants, indicating possible NRE)
- Something is moving an UIPanel GameObject out of view
- Some internal issue corrupts the UIPanel composite texture, making it invisible
As I've said, though, it's very hard to know what exactly happens when I'm unable to reproduce the issue in the Editor or during on-device tests with XCode tethering. Only things I know so far are:
- That the glitch usually happens more than half an hour into non-stop gameplay
- That the glitch affects only certain elements of UI in a very stable manner, absolutely never affecting the background panel, upper menu panel and main menu panel
- That the glitch happens all at once and never gradually
Another problem is that I'm absolutely sure that I don't have a single line in my project code that can control UIPanel depth and alpha, and I don't have a single line moving or destroying the GameObjects that are disappearing. Yet they somehow do disappear.
How can I approach debugging this? I have implemented an ingame debug console, but obviously, I can't just dump the state of every disappearing UIPanel/GameObject on every Update() and hope to get a readable log after it. Is there a cleaner method? For example, a way to hook a debug message to every alpha change, depth change and other change happening with UIPanel properties (if those have getters/setters and aren't just public).