Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - iPedro

Pages: [1]
1
NGUI 3 Support / Re: Adding Items to Grid Programatically
« on: August 14, 2014, 11:11:22 AM »
Thank you Mr. Mook!!  Saw you talk at GDC 2013 and wanted to say hi.  Hopefully will run into you next year!  Thanks for the quick reply and solution!  :D

2
NGUI 3 Support / Adding Items to Grid Programatically
« on: August 13, 2014, 10:22:25 PM »
I'm adding items to a grid inside a scrollview using the following code.  The problem is the first item in the list appears about 2 items down leaving a blank space at the top of the grid/scrollview...  Any idea why this is happening?

  1. UIGrid grid = GameObject.FindWithTag("GamesGrid").GetComponent<UIGrid>() as UIGrid;
  2.  
  3.                         if(!grid)
  4.                                 Debug.LogError("No Grid Found!");
  5.                         else
  6.                         {
  7.                                 for(int i = 0; i < CGameManager.Instance.mGames.Count; i++)
  8.                                 {
  9.                                         GameObject obj = NGUITools.AddChild(grid.gameObject, mGameButton);
  10.                                         obj.GetComponent<GameListItem>().Game = CGameManager.Instance.mGames[i];
  11.                                        
  12.                                         CGameManager.Instance.mGamesListItems.Add(obj);
  13.                                 }
  14.                         }
  15.  
  16.                         grid.Reposition();

Here's a picture of what I mean...


Pages: [1]