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?
UIGrid grid = GameObject.FindWithTag("GamesGrid").GetComponent<UIGrid>() as UIGrid;
if(!grid)
Debug.LogError("No Grid Found!");
else
{
for(int i = 0; i < CGameManager.Instance.mGames.Count; i++)
{
GameObject obj = NGUITools.AddChild(grid.gameObject, mGameButton);
obj.GetComponent<GameListItem>().Game = CGameManager.Instance.mGames[i];
CGameManager.Instance.mGamesListItems.Add(obj);
}
}
grid.Reposition();
Here's a picture of what I mean...