Author Topic: Anchoring bug with UIPanel, after switching resolution, outside editor  (Read 2470 times)

boudinov

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Hello,
It seems we have found a very basal bug with anchored UIPanel, containing widgets anchored(OnEnable) to it. It only happens in standalone builds, not inside the editor!
The scenario is this:
Have a UIPanel, with clipping either 'Soft clip' or 'Constrain but don't clip', anchor it to close to the sides of the UIRoot, with anchor execute mode 'OnEnable'.
Add a sprite within it, big enough, anchor it close to the sides of the panel, with anchor execute mode 'OnEnable'.
Add UIToggle mechanism to activate/deactivate the panel.
Add some mechanism to switch resolution.
Build and start the application.

Toggle activate the panel. Toggle deactivate it.
Switch resolution.
Toggle activate panel. Woala, sprite, and probably panel, do not update rect and stay the same size as in the previous resolution. If you disable and enable second time, sprite resizes correctly. If you switch resoltion while panel is activated, all works fine too.

It also work ok if panel is OnEnable, widget is OnUpdate + panel is OnUpdate, widget is whatever.

NGUI version it 3.5.9

Thanks in advance!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
If I remember correctly, this was already fixed in a later version. You need to update.

boudinov

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Just tested it on 3.6.3 and it does not seem fixed.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Alright, can you send a repro case for me to look at to support at tasharen.com?

boudinov

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Sent an email to support at tasharen.com some days ago. Is that what you meant?
Thanks
« Last Edit: June 12, 2014, 02:19:50 AM by ArenMook »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yup, I got it, thanks.

boudinov

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
So, is it a confirmed issue?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Yup. Changing the widget to OnUpdate works as expected, and OnEnable does not, which would imply there is some script order execution issue happening. I'm looking into it.

Edit: Looks like it happens because the child gets enabled before the parent -- classic Unity bug. Found a fix for it, you will see it in the next update.
« Last Edit: June 13, 2014, 05:48:17 AM by ArenMook »