Author Topic: UIPanel disappearance during prolonged play sessions (?)  (Read 1842 times)

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
UIPanel disappearance during prolonged play sessions (?)
« on: June 10, 2014, 03:07:27 AM »
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).

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Re: UIPanel disappearance during prolonged play sessions (?)
« Reply #1 on: June 10, 2014, 04:11:56 AM »



Implemented a little display that tracks relevant UIPanel and GameObject state on disappearing objects and added the console, hopefully that will provide at least a hint on what's happening.
In the meantime, any advice on catching the issue through other means, recollections of similar issues encountered, or other help would be appreciated.

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Re: UIPanel disappearance during prolonged play sessions (?)
« Reply #2 on: June 10, 2014, 06:10:35 AM »
Phew, I think I tracked it down to RealTime.time being imprecise and allowing for intervals equal to 0 to be calculated, which resulted in a division by 0 in one method and killed a bunch of stuff in the process. Looks like I'll have to clamp every use case of (RealTime.time - lastTime) to some low value.

Still unsure why it killed UIPanels, but still, good to see the issue wasn't originating from NGUI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel disappearance during prolonged play sessions (?)
« Reply #3 on: June 11, 2014, 04:48:50 AM »
NGUI's code never divides anything by RealTime.time. RealTime.time merely represents the total time since the start of the app. When the app begins, this value will be zero, of course. RealTime.deltaTime is what represents the delta since the last frame.