Esempio n. 1
0
        internal static List <GameObject> GetSceneObjects(Scene scene, GameObjectSearchFilter filter)
        {
            List <GameObject> result = new List <GameObject>();

            foreach (GameObject eachRoot in scene.GetRootGameObjects())
            {
                FindChildren(eachRoot, result, filter);
            }

            return(result);
        }
Esempio n. 2
0
        internal static void FindChildren(GameObject gameObject, List <GameObject> result, GameObjectSearchFilter filter)
        {
            SearchResult searchResult = filter.Filter(gameObject);

            if (searchResult.IsInclude())
            {
                result.Add(gameObject);
            }

            if (searchResult.IsContinue())
            {
                for (int i = 0; i < gameObject.transform.childCount; i++)
                {
                    GameObject child = gameObject.transform.GetChild(i).gameObject;
                    FindChildren(child, result, filter);
                }
            }
        }