public GameObject Find(Func <GameObject, bool> del) { foreach (GameObject obj in children) { if (obj != null) { if (del.Invoke(obj)) { return(obj); } else if (obj is IGameObjectContainer) { IGameObjectContainer objContainer = obj as IGameObjectContainer; GameObject subObj = objContainer.Find(del); if (subObj != null) { return(subObj); } } } } return(null); }
public static GameObject Find(this IGameObjectContainer container, string id) { return(container.Find((gobj) => gobj != null && gobj.Id == id)); }