可以直接清空当前物体的子物体
gameObject.transform.DestroyChildren();
还可以对子物体进行批量操作
for (int i = 0; i < gameObject.transform.childCount; i++)
{
gameObject.transform.GetChild(i).localPosition = Vector3.zero;
}
可以直接清空当前物体的子物体
gameObject.transform.DestroyChildren();
还可以对子物体进行批量操作
for (int i = 0; i < gameObject.transform.childCount; i++)
{
gameObject.transform.GetChild(i).localPosition = Vector3.zero;
}
2069

被折叠的 条评论
为什么被折叠?