Author Topic: UILabel Rendering Bug  (Read 2633 times)

xKroniK13x

  • Guest
UILabel Rendering Bug
« on: July 17, 2013, 03:16:11 PM »
I have a panel (we'll call Panel_2) that displays a few different labels that are changed during runtime. When you click a button on Panel_1, it sends the information to panel_2 and changes the labels. Panel_2 also has a back button that returns you to Panel_1. Now, the first time that Panel_2 is loaded, the labels appear perfectly - changes to the correct text, etc. Now, upon returning to Panel_1, clicking another option and returning to Panel_2, all labels disappear - even ones that aren't altered! Now, the really weird part - and why I'm calling this a bug - is that if I go to the navigator, disable Panel_2, and then re-enable it, everything appears correctly.

It is truly bazaar. Only the first time Panel_2 is displayed do the Labels appear. After that, I have to disable and re-enable it. I'm at a real loss here, hopefully it's something easy that I am missing!

OnlineCop

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 51
    • View Profile
Re: UILabel Rendering Bug
« Reply #1 on: July 17, 2013, 04:30:19 PM »
Can you loop through all your Labels, buttons, etc., and see that their Depth values are set correctly (none of them are reusing values that others need)?

When you return to Panel_1, what happens to Panel_2? Does it get destroyed? Does it get disabled? Is it still active but just moved off-camera?

xKroniK13x

  • Guest
Re: UILabel Rendering Bug
« Reply #2 on: July 17, 2013, 11:48:42 PM »
Can you loop through all your Labels, buttons, etc., and see that their Depth values are set correctly (none of them are reusing values that others need)?

When you return to Panel_1, what happens to Panel_2? Does it get destroyed? Does it get disabled? Is it still active but just moved off-camera?

All the depth values remain the same in Panel_2, I double checked to make sure I wasn't accidentally changing them.

I should have clarified that. The panels simply get deactivated when they are not in use... the labels are assigned when Panel_2 is deactivated, then Panel_1 deactivates, and Panel_2 is set to active. So simple Panel_2.active = true; is ran.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel Rendering Bug
« Reply #3 on: July 18, 2013, 04:39:03 AM »
If your labels are not on the same atlas as the rest of your UI (for example you're using dynamic fonts) then you need to bring them closer to the camera by adjusting their transform's Z (negative value). Otherwise the draw order is arbitrary.

xKroniK13x

  • Guest
Re: UILabel Rendering Bug
« Reply #4 on: July 18, 2013, 04:42:27 PM »
If your labels are not on the same atlas as the rest of your UI (for example you're using dynamic fonts) then you need to bring them closer to the camera by adjusting their transform's Z (negative value). Otherwise the draw order is arbitrary.

That did it! A simple Z value change fixed it. Thanks a lot!

kevork

  • Guest
Re: UILabel Rendering Bug
« Reply #5 on: July 18, 2013, 05:36:49 PM »
ArenMook, Dynamic Fonts are great, but this issue plagued us a lot in a primarily UI project.  Would you be open to adding something like "if(lbl.font.isDynamic) lbl.font.transform.Translate(0f, 0f, -1f);" to UICreateWidgetWizard::CreateLabel()? (~Line 207)

What really got us is that the editor would regularly draw in the order that didn't give the bug, but on device (ios, android) it would draw in the opposite order, which would make all the currently disabled text disappear.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel Rendering Bug
« Reply #6 on: July 19, 2013, 01:45:36 AM »
Most certainly, kevork. That's actually a good idea.