fix destroying a gameobject inside a prefab

This commit is contained in:
Jacob Rapoport
2019-10-27 09:05:50 -07:00
committed by monitor1394
parent 54ee3d43f5
commit 16c8d26e2a
3 changed files with 5 additions and 5 deletions

View File

@@ -72,12 +72,12 @@ namespace XCharts
}
}
public static void DestoryAllChilds(Transform parent)
public static void DestroyAllChildren(Transform parent)
{
while (parent.childCount > 0)
{
var go = parent.GetChild(0);
if (go.childCount > 0) DestoryAllChilds(go);
if (go.childCount > 0) DestroyAllChildren(go);
else GameObject.DestroyImmediate(go.gameObject);
}
}