找回密码
 立即注册
查看: 179|回复: 0

Unity 遍历子物体的两种方式

[复制链接]
发表于 2022-12-26 18:41 | 显示全部楼层 |阅读模式
第一种:
foreach (Transform child in parent){     print(child.name);}
第二种:
for (int i = 0; i < parent.childCount; i++) {     Transform child = parent.GetChild(i);     print(child.name);}
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-5-8 12:13 , Processed in 0.088660 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表