Hi, thanks for the answer, I removed all those WaitForEndOfFrame and changed the order of the grid reposition so the code looks like this now:
private void reloadResourceItemsGrid() {
if (resourcesGrid.transform.childCount > 0) {
while (resourcesGrid.transform.childCount > 0) {
NGUITools.Destroy(resourcesGrid.transform.GetChild(0).gameObject);
}
}
foreach (ShopResource resource in _resources) {
GameObject shopResourceItem = NGUITools.AddChild(resourcesGrid.gameObject, resourceItem);
shopResourceItem.GetComponent<ShopResourceItem>().setItem(resource.quantity,
resource.price,
resource.currency);
}
resourcesGrid.Reposition ();
resourcesGrid.transform.parent.gameObject.GetComponent<UIScrollView> ().ResetPosition ();
}
But unfortunately I'm still having the visualization problem (see attached screenshots). If I reposition the grid from the inspector (with execute in UIGrid component) it fits OK, but I cant find the proper way to do it within the code.
Please, note that as I said in the first message, I have an animation that shows the panel and maybe it is related with the problem.
Thanks.