protected Transform DeepFindChild(Transform root, string childName)
{
Transform result = null;
result = root.Find(childName);
if (result == null)
{
foreach (Transform trs in root)
{
result = DeepFindChild(trs, childName);
if (result != null)
{
return result;
}
}
}
return result;
}
unity遍历查找孩子节点
本文介绍了一个用于在Unity中递归查找指定名字子对象的方法。该方法从根节点开始搜索,若未找到,则继续在其子节点中进行深度优先搜索。

被折叠的 条评论
为什么被折叠?



