*
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Utils {
|
||||
public static GameObject FindChildRecursive(GameObject obj, string name){
|
||||
var child = obj.transform.FindChild (name);
|
||||
if (child != null) {
|
||||
return child.gameObject;
|
||||
}
|
||||
|
||||
for(int i = 0; i < obj.transform.childCount; ++i){
|
||||
var rchild = FindChildRecursive(obj.transform.GetChild(i).gameObject, name);
|
||||
if(rchild != null){
|
||||
return rchild.gameObject;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user