Destroy(t.GetChild(t.childCount-1).gameObject);
if (t.childCount == 0)
{
}
这种写法不行,因为Destroy()不是立即删除,childCount还是删除前的值,不知道有没回调函数之类的
可以看下面文章的评论有解释
https://blog.csdn.net/qq_37244872/article/details/89536282#comments_12321685
Destroy(t.GetChild(t.childCount-1).gameObject);
if (t.childCount == 0)
{
}
这种写法不行,因为Destroy()不是立即删除,childCount还是删除前的值,不知道有没回调函数之类的
可以看下面文章的评论有解释
https://blog.csdn.net/qq_37244872/article/details/89536282#comments_12321685