public static IList <GameObject> ListChildren(GameObject obj, CGameObjectFilter filter) { IList <GameObject> list = new List <GameObject>(); GameObject[] children = obj.GetComponents <GameObject>(); foreach (GameObject child in children) { if (filter(child)) { list.Add(child); } } return(list); }
public static IList <GameObject> ListGameObjects(CGameObjectFilter filter) { IList <GameObject> list = new List <GameObject>(); GameObject[] objects = GameObject.FindObjectsOfType <GameObject>(); foreach (GameObject obj in objects) { if (filter(obj)) { list.Add(obj); } } return(list); }
public static IList <GameObject> ListChildren(string name, CGameObjectFilter filter) { GameObject obj = GameObject.Find(name); return(obj != null?ListChildren(obj, filter) : null); }