Exemple #1
0
    public static T InstantiateGameObject <T>(T OriginObj, Transform trParent = null, SetTransformType TransType = SetTransformType.IgnoreValue, string strName = "") where T : Component
    {
        GameObject resultObj = InstantiateGameObject(OriginObj.gameObject, trParent, TransType, strName);

        if (resultObj == null)
        {
            return(default(T));
        }

        return(resultObj.GetComponent <T>());
    }
Exemple #2
0
    // <summary>
    // 트랜스폼 디폴트 타입은 포지션 0, 스케일 1
    // </summary>
    public static GameObject InstantiateGameObject(GameObject OriginObj, Transform trParent = null, SetTransformType TransType = SetTransformType.IgnoreValue, string strName = "")
    {
        GameObject resultObj = GameObject.Instantiate(OriginObj) as GameObject;

        if (resultObj == null)
        {
#if DEBUG_LOG
            Debug.LogError(string.Format("error InstantiateGameObject --- OBJECT NAME : {0}", OriginObj.ToString()));
#endif
#if DEBUG_LOG
            Debug.LogError(string.Format("error InstantiateGameObject --- PARENT : {0}", trParent.name));
#endif
#if DEBUG_LOG
            Debug.LogError(string.Format("error InstantiateGameObject --- PREFAB RENAME : {0}", strName));
#endif
            return(null);
        }

        if (string.IsNullOrEmpty(strName) == false)
        {
            resultObj.name = strName;
        }

        UtilTransform.AttachTransForm(trParent, resultObj.transform, TransType);

#if ASSET_BUNDLE
        ReLinkAtlas(resultObj);
#endif

        return(resultObj);
    }
Exemple #3
0
    public static T CreatePrefab <T>(BUNDLELIST bundleList, Transform aParentTrs, string aPrefabName, SetTransformType TransformType = SetTransformType.OriginValue)
    {
        GameObject resultObj = CreatePrefab(bundleList, aParentTrs, aPrefabName, TransformType);

        if (resultObj == null)
        {
            return(default(T));
        }

        return(resultObj.GetComponent <T>());
    }
Exemple #4
0
    // Instantiate 한 크리쳐 모델 로드하고 리턴.
    public static GameObject CreateCreatureModel(string szResourceName, string changeName, Transform parent, SetTransformType TransformType)
    {
#if ASSET_BUNDLE
        GameObject OriginObj = ResourceBundle.intance.ResourceObject(UtilFunc.GetCreatureBundleName(szResourceName), szResourceName, typeof(GameObject)) as GameObject;
#else
        GameObject OriginObj = Resources.Load(UtilFunc.GetCreatureResName(szResourceName)) as GameObject;
#endif
        if (OriginObj == null)
        {
#if DEBUG_LOG
            Debug.LogError(string.Format("<color=red>UIResourceMgr->LoadInstantiateCreatureModel 크리쳐 모델 로드 실패 모델 리소스 {0} 가 존재하지 않는다.</color>", szResourceName));
#endif
            return(null);
        }

        if (string.IsNullOrEmpty(changeName) == true)
        {
            changeName = OriginObj.name;
        }

        GameObject resultObj = InstantiateGameObject(OriginObj, parent, TransformType, changeName);

        return(resultObj);
    }
Exemple #5
0
    //==================================================================================
    //
    // 에셋 번들 로드
    //
    //==================================================================================
    public static GameObject CreatePrefab(BUNDLELIST bundleList, Transform aParentTrs, string aPrefabName, SetTransformType TransformType = SetTransformType.OriginValue)
    {
#if ASSET_BUNDLE
        GameObject resultObj = ResourceBundle.intance.ResourceObject(bundleList, aPrefabName, typeof(GameObject)) as GameObject;
#else
        GameObject resultObj = Resources.Load(ResourcePathInfo.intance.GetResourcePathInfo(bundleList, aPrefabName)) as GameObject;
#endif
        if (resultObj == null)
        {
#if DEBUG_LOG
            Debug.LogError(string.Format("error CreatePrefab --- bundleList : {0}", bundleList.ToString()));
            Debug.LogError(string.Format("error CreatePrefab --- aParentTrs : {0}", aParentTrs.name));
            Debug.LogError(string.Format("error CreatePrefab --- aPrefabName : {0}", aPrefabName));
#endif
            return(null);
        }

        resultObj = InstantiateGameObject(resultObj, aParentTrs, TransformType, aPrefabName);

        return(resultObj);
    }