while (randomGeneration.transform.childCount != 0)
{
DestroyImmediate(randomGeneration.transform.GetChild(0).gameObject);
}
这样他只要子物体有东西他就删,直到为0
while (randomGeneration.transform.childCount != 0)
{
DestroyImmediate(randomGeneration.transform.GetChild(0).gameObject);
}
这样他只要子物体有东西他就删,直到为0
本文标题:Unity怎么清理Gameobject下所有的子物体
本文链接:https://www.haomeiwen.com/subject/ffyljdtx.html
网友评论