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();