Unity Find GameObject por nombre
GameObject enemy = GameObject.Find("enemy");
RasKaL
GameObject enemy = GameObject.Find("enemy");
GameObject FindChildRecursive(GameObject parent, string childName) {
foreach(Transform child in parent.transform) {
if(child.name == childName) {
return child.gameObject;
} else {
if(child.childCount > 0) {
GameObject result = FindChildRecursive(child.gameObject, childName);
if(result != null) return result;
}
}
}
return null;
}