如何找到子游戏对象? [英] How can I find child gameobject?
本文介绍了如何找到子游戏对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想说些类似的话.
Gameobject.find(child gameobject of specific parent Gameobject)
任何人都可以帮助我. 谢谢!
Can anyone help me. thanks!
推荐答案
GameObject.Find
将在场景中搜索游戏对象.要从父级搜索游戏对象,请使用Transform
.
GameObject.Find
will search for a gameobject in the scene. To search a gameobject from a parent, use Transform
.
有2种方法:
-
transform.Find("childname")
-
transform.FindChild("childname")
transform.Find("childname")
transform.FindChild("childname")
不建议使用第二个选项,但仍可以使用,因此最好使用第一个选项.
The 2nd option is deprecated but still functional, so you'd better use the 1st option.
这篇关于如何找到子游戏对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文