Author Topic: Anchoring bug  (Read 1920 times)

MrTact

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 32
    • View Profile
Anchoring bug
« on: June 25, 2013, 04:38:45 PM »
I have run into this several times with my project now. I recently updated to the most current version of NGUI, and this still recurred.

When anchoring an object (a UILabel and a UISprite thus far) to another widget, sometimes the Z value of the anchored object will slowly change over time. Eventually the object will walk its way outside the camera bounds! This seems like a floating point precision issue, but I have not had any success identifying where it's happening as yet.

At some point I will devote some serious time to tracking this down, but in the meantime I thought I would bring it up here in case anyone else is running into this, and in case anyone happens to find a fix for it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring bug
« Reply #1 on: June 25, 2013, 05:46:33 PM »
I don't advise anchoring stuff to widgets. Just the screen. Although it's supported, if you find yourself in a situation where you have to anchor a widget to another widget, then you likely are doing something wrong. NGUI has a UITable to do this properly. Beyond that -- it's best to use custom code, or set your anchors to run only once.

MrTact

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Anchoring bug
« Reply #2 on: June 26, 2013, 02:12:23 PM »
Interesting. I think we're using this pretty extensively... will have to reassess. "Run once" is the method I've chosen to resolve the problem in the near term, so that may end up being the ultimate solution.