unity3d遍历出Cube里面所有子对象

 cube目录下有n个cube,可不可以一下子遍历出所有的对象,而不用一个一个的find?find(“Cube1”)
 
1、foreach(Transform ts in cube)
 
2、cube.getCompontsInChildren
 
返回transform的数组
 
3、GameObject[] gos;  gos = GameObject.FindGameObjectsWithTag("Enemy");
原文地址:https://www.cnblogs.com/zhibolife/p/3747531.html