设置游戏对象的子对象
sonObject.transform.parent = fatherObject.transform;
获取子对象的数量
father.transform.childCount;
遍历子对象
foreach (Transform child in father.transform){
Debug.log(child.gameObject.name);
}
设置游戏对象的子对象
sonObject.transform.parent = fatherObject.transform;
获取子对象的数量
father.transform.childCount;
遍历子对象
foreach (Transform child in father.transform){
Debug.log(child.gameObject.name);
}
本文标题:子对象相关
本文链接:https://www.haomeiwen.com/subject/dcvmjxtx.html
网友评论