Author Topic: NGUIMath.CalculateRelativeWidgetBounds return same result for different objects  (Read 2770 times)

strobe

  • Guest
I would like to calculate bounds of UIGrid content.

I have few UIGrid widgets  (in clipped panel)  with different counts of items which is added to grid dynamically (created from prefab), after all items has been added I raise the event. By this event I launched calculation of bound by NGUIMath.Calculate... and result for all UIGrids with different InstanceIDs, and content - is always same and value of it is looks like bound of the one item attached to grid (but items has correct arrangement ).

I guess I need do something before call NGUIMath.Calculate but what?

I use NGUI 2.7.
« Last Edit: November 26, 2013, 11:05:07 AM by strobe »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Do you wait for the grid to actually perform the repositioning? Because it doesn't happen until after its Update() executes unless you force it early.

strobe

  • Guest
Thanks. I have simply moved calculation to LateUpdate and got correct results.