Author Topic: // UIGrid leaves gaps after reposition //  (Read 1653 times)

AlexSudnikov

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
// UIGrid leaves gaps after reposition //
« on: November 03, 2014, 07:25:18 AM »
Hi there ,

Well the thing is that i've got a scrollable panel implemented via UIScrollView and UIGrid. I also have a script adding instantiated elements ( buttons ) to the grid. Before adding new set of elements i remove current elements with UIGrid::RemoveChild method and then destroy removed elements. Once new elements are added , i call UIGrid::Reposition method.
The problem is that there are weird gaps left in grid once new elements are added...
Any tips are greatly appreciated.

Thanks!^^

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: // UIGrid leaves gaps after reposition //
« Reply #1 on: November 04, 2014, 09:14:14 AM »
You need to use NGUITools.Destroy to remove items. Otherwise they are still here. Unity doesn't remove items until the end of the frame.

AlexSudnikov

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: // UIGrid leaves gaps after reposition //
« Reply #2 on: November 05, 2014, 08:33:53 AM »
Thanks!