Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: strobe on November 26, 2013, 10:57:08 AM

Title: NGUIMath.CalculateRelativeWidgetBounds return same result for different objects
Post by: strobe on November 26, 2013, 10:57:08 AM
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.
Title: Re: NGUIMath.CalculateRelativeWidgetBounds return same result for different objects
Post by: ArenMook on November 26, 2013, 11:25:31 AM
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.
Title: Re: NGUIMath.CalculateRelativeWidgetBounds return same result for different objects
Post by: strobe on November 28, 2013, 03:22:25 AM
Thanks. I have simply moved calculation to LateUpdate and got correct results.