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); } }
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); } }