コード例 #1
0
    static public T _GetComponentOfChildrenWithTag <T> (GameObject _gameObject, string _tag)
    {
        GameObject ob = UtilFinder._FindChildByTag(_tag, _gameObject);

        if (ob != null)
        {
            T comp = ob.GetComponent <T> ();

            if (comp.ToString() == "null")
            {
                Debug.Log("_WARNING_ - NOT FOUND component '" + typeof(T) + "' inside '" + ob.name + "'");
            }

            return(comp);
        }
        else
        {
            Debug.Log("_WARNING_ - NOT FOUND gameobject child with tag '" + _tag + "' inside the gameobejct '" + _gameObject.name + "', during getting its component '" + typeof(T) + "'");
            //T comp = null;
            return(default(T));
        }
    }