优化DestroyAllChildren接口

This commit is contained in:
monitor1394
2019-10-31 09:46:18 +08:00
parent 2dc3c2f759
commit 2aef62be98

View File

@@ -87,8 +87,10 @@ namespace XCharts
while (parent.childCount > 0) while (parent.childCount > 0)
{ {
var go = parent.GetChild(0); var go = parent.GetChild(0);
if (go.childCount > 0) DestroyAllChildren(go); if (go != null)
else GameObject.DestroyImmediate(go.gameObject); {
GameObject.DestroyImmediate(go.gameObject);
}
} }
} }