public static Transform GetChildByName(this Transform transform, string name, bool recursive = true, bool includeInactive = true) { Transform target; for (int i = 0; i < transform.childCount; i++) { Transform child = transform.GetChild(i); if (child != null && (includeInactive || transform.gameObject.activeSelf)) { if (child.name == name) { return(child); } else { target = child.GetChildByName(name); if (target != null) { return(target); } } } } return(null); }