Author Topic: Sprites blink when depth changes  (Read 1279 times)

jguibault

  • Guest
Sprites blink when depth changes
« on: December 20, 2013, 11:19:04 AM »
When upgrading from NGUI 3.0.5 to 3.0.7f3, sprites are now blinking when they are moved to a lower depth.

In my character selection screen, I have four character portraits in each quadrant of the screen, where players can pick their character or set up an AI. When they select a portrait, that portraits sprites are moved to a higher numerical depth. Then the settings modal is turned on behind the objects, and scale tweened outward, to cover the other three portraits, while leaving the selected one showing. The player can then set up the character. This works with no issues.

Once the user is done selecting their settings, they click the accept button, and the settings tween back behind the character portraits and disappear. Once the modal has shrank, and been turned off, the character portrait sprites are returned to their normal depth, so the player can resume character setup. This works with no issues.

After this is done, the character's depth is set back to its value, so the process can all be done again. In 3.0.5 this caused no issues. On 3.0.7f3 (and on 3.0.7f1 as well), the sprites blink when their depth is changed. Before the depth change, the sprites are the top drawn items, after the depth change, the remain the top drawn items.

I've tried adding a Panel.Refresh(), as well as a few other things, but to no avail. If anyone has any other suggestions, they would be much appreciated.



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sprites blink when depth changes
« Reply #1 on: December 20, 2013, 11:28:40 AM »
Call UIWidget.CreatePanel() immediately after your changes. I'll make some changes so this won't be necessary in 3.0.8.

jguibault

  • Guest
Re: Sprites blink when depth changes
« Reply #2 on: December 20, 2013, 11:45:13 AM »
Yep, that fixed the issue, thank you!!