How to Recalculate or Re set the size of childs in GridLayoutGroup in Unity3d -


in game have 1 gridlayoutgroup ui. reason need remove childern of gridlayoutgroup , add new child . code removing child is:

    private void removeallcards(){     int childs = transform.childcount;     (int = childs - 1; > 0; i--)     {         gameobject.destroy(transform.getchild(i).gameobject);     } } 

but after add new items gridlayoutgroup y position of items start last item deleted. question how recalculate or reposition of new items in gridlayoutgroup

all need reorder game objects in hierarchy. can these methods:

transform.setaslastsibling(); transform.setasfirstsibling(); transform.setsiblingindex(); 

Comments