Hi
I am trying empty my GridLayoutGroup before show my buttons into GridLayoutGroup?
My code:
foreach (enemy en in xnList)
{
//First Clean
//<<<<=====
//Later Show the Results Here
GameObject enemyList = Instantiate (myButton) as GameObject;
enemyList.transform.SetParent (myPanel.transform, false);
}
Thank You
I think GridLayoutGroup considers the transform children for what it displays.
You can iterate the transforms and destroy them directly:
for (int i = 0; i < myGrid.transform.childCount; i++)
{
Destroy( myGrid.transform.GetChild(i).gameObject);
}
where myGrid is a reference to your GridLayoutGroup.
Then you repopulate them with new bits that you create/load, by using transform.SetParent( myGrid.transform);
First, Thank You my friend. so, I am using a Foreach. I am confused.
foreach (XmlNode xn in xnList)
{
}
Thank You