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");
posted @ 2014-05-23 13:36  zhibolife  阅读(1742)  评论(0编辑  收藏  举报