コード例 #1
0
        public static void GetComponentsOnTarg(GameObject container, ICollection <T> coll, bool includeComponentsOnContainer)
        {
            if (includeComponentsOnContainer)
            {
                ComponentUtil.GetComponentsAlt <T>(container, coll);
            }

            for (int i = 0; i < container.transform.childCount; i++)
            {
                ComponentUtil.GetComponentsAlt <T>(container.transform.GetChild(i), coll);
            }
        }
コード例 #2
0
        public static TSub[] GetComponentsOnTarg <TSub>(GameObject container, bool includeComponentsOnContainer) where TSub : class, T
        {
            using (var set = com.spacepuppy.Collections.TempCollection.GetSet <TSub>())
            {
                if (includeComponentsOnContainer)
                {
                    ComponentUtil.GetComponentsAlt <TSub>(container, set);
                }

                for (int i = 0; i < container.transform.childCount; i++)
                {
                    ComponentUtil.GetComponentsAlt <TSub>(container.transform.GetChild(i), set);
                }

                return(set.ToArray());
            }
        }