Author Topic: UIGrid reposition acting strange  (Read 3409 times)

masterprompt

  • Guest
UIGrid reposition acting strange
« on: April 17, 2012, 08:00:09 AM »
Hi.

So I'm dynamically loading a draggable panel in script

  1. GameObject thisObject = NGUITools.AddChild(grid.gameObject, prefab);
  2.  

After I get all the objects in, I run this:

  1. grid.Reposition();
  2.  

But it only works the first time.  Every time I clear the list (going through each widget in the widgets list for the panel and removing them, then destroying them, then adding all the new ones, then hit the resposition again) the list goes flat (single row) where I have 2 rows set in the parameters of the grid.  Any thoughts?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIGrid reposition acting strange
« Reply #1 on: April 17, 2012, 06:07:36 PM »
For the future reference, the issue was with where the Reposition was called from. It needs to be from Update. If it's not, set 'repositionNow = true' instead.