コード例 #1
0
        public static GameObject FindWithMultiTag(string tag)
        {
            if (tag == SPConstants.TAG_MULTITAG)
            {
                return(GameObject.FindWithTag(SPConstants.TAG_MULTITAG));
            }
            else
            {
                var directHit = GameObject.FindWithTag(tag);
                if (directHit != null)
                {
                    return(directHit);
                }

                //MultiTag comp;
                //foreach (var go in GameObject.FindGameObjectsWithTag(SPConstants.TAG_MULTITAG))
                //{
                //    if (go.GetComponent<MultiTag>(out comp))
                //    {
                //        if (comp.ContainsTag(tag)) return go;
                //    }
                //}

                var comp = MultiTag.Find(tag);
                return((comp != null) ? comp.gameObject : null);
            }
        }
コード例 #2
0
        public static GameObject FindWithMultiTag(string tag)
        {
            if (tag == SPConstants.TAG_MULTITAG)
            {
                return(GameObject.FindWithTag(SPConstants.TAG_MULTITAG));
            }
            else
            {
                var directHit = GameObject.FindWithTag(tag);
                if (directHit != null)
                {
                    return(directHit);
                }

                var comp = MultiTag.Find(tag);
                return((comp != null) ? comp.gameObject : null);
            }
        }