예제 #1
0
        public static GameObject Find(string selector)
        {
            SelectorChain  selectors = new SelectorChain(selector);
            FindVisitor    visitor   = new FindVisitor(selectors);
            SceneDescender descender = new SceneDescender(SceneManager.GetActiveScene());

            descender.Descend(visitor);

            Transform result = visitor.GetTransform();

            return(result != null ? result.gameObject : null);
        }
예제 #2
0
        public static GameObject[] FindAll(string selector)
        {
            SelectorChain  selectors = new SelectorChain(selector);
            FindAllVisitor visitor   = new FindAllVisitor(selectors);
            SceneDescender descender = new SceneDescender(SceneManager.GetActiveScene());

            descender.Descend(visitor);

            Transform[]  results = visitor.GetTransforms();
            GameObject[] output  = GetGameObjectsFromTransforms(results);
            return(output);
        }