Files
CityOfTheDead.Unity/Assets/Scripts/Utils.cs
T

20 lines
457 B
C#
Raw Normal View History

2025-05-13 05:05:49 +03:00
using UnityEngine;
using System.Collections;
public class Utils {
public static GameObject FindChildRecursive(GameObject obj, string name){
2025-05-13 05:12:44 +03:00
var child = obj.transform.Find (name);
2025-05-13 05:05:49 +03:00
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;
}
}