当前位置: 首页>>代码示例>>C#>>正文


C# AssetBundle.LoadAsset方法代码示例

本文整理汇总了C#中AssetBundle.LoadAsset方法的典型用法代码示例。如果您正苦于以下问题:C# AssetBundle.LoadAsset方法的具体用法?C# AssetBundle.LoadAsset怎么用?C# AssetBundle.LoadAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AssetBundle的用法示例。


在下文中一共展示了AssetBundle.LoadAsset方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DownloadAssetBundle

    IEnumerator DownloadAssetBundle()
    {
        yield return StartCoroutine(AssetBundleManager.downloadAssetBundle(url, version));

        bundle = AssetBundleManager.getAssetBundle(url, version);

        if (bundle != null)
            AssetLoader.Instance.SetInfoText("Download Success.... ");
        else
            AssetLoader.Instance.SetInfoText("Download error please retry");

        GameObject obj = Instantiate(bundle.LoadAsset("ExampleObject"),Vector3.zero,Quaternion.identity) as GameObject;
        // Unload the AssetBundles compressed contents to conserve memory
        //Debug.Log(obj);
        bundle.Unload(false);
    }
开发者ID:cloudhu,项目名称:create-and-download-asset-bundle-in-unity,代码行数:16,代码来源:AssetLoader.cs

示例2: Start

    void Start()
    {
        m_cube = AssetBundle.LoadFromFile("C:\\Users\\yunsubaek_df\\Documents\\AssetBundleTest1\\AssetBundles\\Windows\\cube-bundle");

        cube_obj = (GameObject)m_cube.LoadAsset<GameObject>("Cube");
        GameObject.Instantiate(cube_obj,new Vector3(1,1,1),Quaternion.identity);
    }
开发者ID:yunsubaek,项目名称:Unity3D,代码行数:7,代码来源:AssutBundle_example.cs

示例3: OnAssetsLoadingComplete

 void OnAssetsLoadingComplete(AssetBundle a_assetsbundle, AssetsInfo a_assetsInfo)
 {
     TotalAssets++;
     GameObject loadedObject;
     loadedObject = Instantiate(a_assetsbundle.LoadAsset(a_assetsInfo.AssetName, typeof(GameObject))) as GameObject;
     loadedObject.SetActive(false);
     m_assetsGameObjlst.Add(loadedObject.GetComponent<AssetsData>());
     if (TotalAssets == GameManager.Instance.AllAssetsInfoList.Count)
     {
       GameState l_gameState =  FiniteStateMachine.Instance.GetCurrentState<GameState>();
         l_gameState.MakeActiveArCameraAndImageTarget(m_assetsGameObjlst);
     }
 }
开发者ID:SillyGames,项目名称:T_r_e_a_s_u_r_e_H_u_n_t,代码行数:13,代码来源:GameManager.cs

示例4: LoadManifest

	public IEnumerator LoadManifest()
	{
		WWW manifest = new WWW (manifestPath);

		yield return manifest;

		if (!string.IsNullOrEmpty (manifest.error)) {
			Debug.Log (manifest.error);
		} else {
			if (manifest.progress >= 1.0f) {
				manifestLoader = manifest.assetBundle;

				assetManifest = manifestLoader.LoadAsset ("AssetBundleManifest") as AssetBundleManifest;

				IsLoadFinish = true;
			}
		}
	}
开发者ID:liangxiegame,项目名称:QFramework,代码行数:18,代码来源:IABManifestLoader.cs

示例5: LoadZombie

    IEnumerator LoadZombie(int index)
    {
        string bundleName = string.Format("myzombie{0}", index);
        string assetName = string.Format("myzombie{0}", index);
        string url = string.Format("file://{0}/{1}/{2}", Application.dataPath, bundlePath, bundleName);

        WWW www = WWW.LoadFromCacheOrDownload(url, 0);
        yield return www;

        if(!string.IsNullOrEmpty(www.error))
        {
            Debug.LogError(www.error);
            return false;
        }

        downloadedAB = www.assetBundle;
        if (downloadedAB == null)
        {
            Debug.LogError("can't load assetbundle");
            return false;
        }

        /*
        Object[] objs = downloadedAB.LoadAllAssets();
        foreach(Object o in objs)
        {
            Debug.Log(string.Format("object name: {0}", o.name));
        }
        */

        Object obj = downloadedAB.LoadAsset(assetName);
        GameObject inst = Instantiate(obj) as GameObject;
        if (inst == null)
        {
            return false;
        }
        Debug.Log ("Prefab| instanceID: " + inst.GetInstanceID ());
        Debug.Log ("Prefab| Animator instanceID: " + inst.GetComponent<Animator> ().GetInstanceID ());
        Debug.Log ("Prefab| Avatar instanceID: " + inst.GetComponent<Animator> ().avatar.GetInstanceID ());
        Debug.Log ("---------------------------------------------------");
        //inst.transform.parent = gameObject.transform.parent;
        inst.transform.position = Vector3.zero;
        //downloadedAB.Unload (false);
    }
开发者ID:ylyking,项目名称:NewABSystem,代码行数:44,代码来源:LoadAB.cs

示例6: Start

	// Use this for initialization
	void Start () {
		string assetsBundlePath = Application.streamingAssetsPath + "/bundle/";

		if(bundle != null)
			bundle.Unload(false);
		bundle = AssetBundle.LoadFromFile(assetsBundlePath + "bundle");

		string[] allAssetNames = bundle.GetAllAssetNames();
		foreach(var assetName in allAssetNames){
			print("AssetName: " + assetName);
			AssetBundleManifest assetBundleManifest = bundle.LoadAsset(assetName) as AssetBundleManifest;
			string[] allAssetBundles = assetBundleManifest.GetAllAssetBundles();
			foreach(var assetBundle in allAssetBundles){
				print("AssetBundleName: " + assetBundle);
				bundle = AssetBundle.LoadFromFile(assetsBundlePath + assetBundle);
				GameObject go = bundle.LoadAsset(assetBundle) as GameObject;
				Instantiate(go);
			}

		}

	}
开发者ID:ChiPengWu,项目名称:AssetBundleManager,代码行数:23,代码来源:LoadBundle.cs

示例7: SetObjectModel

    public void SetObjectModel(OSLibObject obj, AssetBundle assets)
    {
        _objectModel = obj;
        _nbConfMats = _objectModel.GetModules().GetStandardModuleList().Count;
        // apply default materials
        foreach (OSLibModule mod in obj.GetModules ().GetStandardModuleList())
        {
            Transform modTarget = transform.Find (mod.GetModuleType ());
            Color colorText = new Color(0.78f,0.78f,0.78f,1.0f);
            if (modTarget != null)
            {
                if (mod.GetColorList ().Count > 0)
                {
                    OSLibColor color = OSLibBuilderUtils.
                        GetFirstColorOfType(mod, mod.GetModuleType ());
                    modTarget.GetComponent<Renderer>().material.color = color.GetColor ();
                    if(modTarget.GetComponent<MeshRenderer>())
                    {
                        modTarget.GetComponent<Renderer>().material.mainTexture = null;
                        if((modTarget.GetComponent<Renderer>().material.HasProperty("_DecalTex")) && (usefullData.lowTechnologie))
                        {
                            modTarget.GetComponent<Renderer>().material.mainTexture = modTarget.GetComponent<Renderer>().material.GetTexture("_DecalTex");
                        }
                    }

                    if(color.GetColorType2()!=null)
                    {
                        Transform modTarget2 = transform.Find (color.GetColorType2());
                        if (modTarget2 != null)
                        {
                            Color color2 = color.GetColor2();
                            modTarget2.GetComponent<Renderer>().material.mainTexture = null;
                            modTarget2.GetComponent<Renderer>().material.color = color2;
                        }
                    }
                }
                else if (mod.GetTextureList ().Count > 0)
                {
                    OSLibTexture textData = OSLibBuilderUtils.
                                                GetFirstTextureOfType (mod, mod.GetModuleType ());

                    Texture2D text = assets.LoadAsset (textData.GetFilePath (),
                                                       typeof (Texture2D)) as Texture2D;
                    if(modTarget.GetComponent<Renderer>().material.shader.name.Contains("Pointcube"))
                    {
                        Debug.Log(text.name + " TEXTURES");
                        modTarget.GetComponent<Renderer>().material.SetTexture("_Diffuse",text);
                        /*modTarget.GetComponent<Renderer>().material.SetTexture("_Normal",text);
                        modTarget.GetComponent<Renderer>().material.SetTexture("_HueMask",text);
                        modTarget.GetComponent<Renderer>().material.SetTexture("_SpecMask",text);*/
                        modTarget.GetComponent<Renderer>().material.color = colorText;
                        float scale = textData.GetScale();

                        if(textData.GetTextureType2()!=null)
                        {
                            Transform modTarget2 = transform.Find (textData.GetTextureType2());
                            if (modTarget2 != null)
                            {
                                Texture2D text2 = assets.LoadAsset (textData.GetFilePath2 (),
                                                                    typeof (Texture2D)) as Texture2D;
                                modTarget2.GetComponent<Renderer>().material.mainTexture = text2;
                                modTarget2.GetComponent<Renderer>().material.color = colorText;
                                modTarget2.GetComponent<Renderer>().material.SetTextureScale("_MainTex",new Vector2(scale,scale));
                            }
                        }
                    }
                    else{
                        modTarget.GetComponent<Renderer>().material.mainTexture = text;
                        modTarget.GetComponent<Renderer>().material.color = colorText;
                        float scale = textData.GetScale();
                        if (modTarget.name.CompareTo("plage")==0)
                            scale/=2.0f;
                        modTarget.GetComponent<Renderer>().material.SetTextureScale("_MainTex",new Vector2(scale,scale));

                        if(textData.GetTextureType2()!=null)
                        {
                            Transform modTarget2 = transform.Find (textData.GetTextureType2());
                            if (modTarget2 != null)
                            {
                                Texture2D text2 = assets.LoadAsset (textData.GetFilePath2 (),
                                                           typeof (Texture2D)) as Texture2D;
                                modTarget2.GetComponent<Renderer>().material.mainTexture = text2;
                                modTarget2.GetComponent<Renderer>().material.color = colorText;
                                modTarget2.GetComponent<Renderer>().material.SetTextureScale("_MainTex",new Vector2(scale,scale));
                            }
                        }
                    }
                }
                subObjects.Add(mod.GetModuleType(),0);
            }
        }
    }
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:92,代码来源:ObjData.cs

示例8: InitializeFromAssetBundle

    // 从资源包初始化脚本环境
    public void InitializeFromAssetBundle(AssetBundle scriptsAssetBundle)
    {
        m_clsAssetBundle = scriptsAssetBundle;

        #if UNITY_EDITOR
        float timeStart = Time.realtimeSinceStartup;
        uint monoStart = Profiler.GetMonoUsedSize();
        #endif

        // 获取默认的脚本实例
        m_clsEnv = ToCSLight.CreateEnvironment();
        m_clsContent = m_clsEnv.CreateContent();

        // 预注册脚本类
        #if UNITY_EDITOR && !EDITOR_FORCE_ASSET_BUNDLE
        string rootPath = Application.dataPath + "/CSLight/Editor/CSLogic";
        string[] files = System.IO.Directory.GetFiles(rootPath, "*.cs", System.IO.SearchOption.AllDirectories);
        foreach (var file in files)
        {
            string className = System.IO.Path.GetFileNameWithoutExtension(file);
            m_clsEnv.RegType(new CLS_Type_Class(className, file.Replace('\\', '/')));
        }
        #else
        StringHolder classHolder = m_clsAssetBundle.LoadAsset("class", typeof(StringHolder)) as StringHolder;
        foreach (string className in classHolder.content)
        {
            m_clsEnv.RegType(new CLS_Type_Class(className, className));
        }
        #endif

        #if UNITY_EDITOR
        Debug.Log("script init cost time: " + (Time.realtimeSinceStartup - timeStart));
        Debug.Log(string.Format("script init cost memory: {0:0.00}MB", (Profiler.GetMonoUsedSize() - monoStart) / (1024f * 1024f)));
        timeStart = Time.realtimeSinceStartup;
        #endif
    }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:37,代码来源:CSLightMng.cs

示例9: DownloadAssetBundle

    private IEnumerator DownloadAssetBundle(string asset, string bundleName, int version)
    {
        loadedAsset = null;

        // Wait for the Caching system to be ready
        while (!Caching.ready)
        {
            yield return null;
        }

        string url = baseURL + bundleName;

        // Start the download
        using (WWW www = WWW.LoadFromCacheOrDownload(url, version))
        {
            yield return www;
            if (www.error != null)
            {
                throw new System.Exception("AssetBundle - WWW download:" + www.error);
            }
            thisAssetBundle = www.assetBundle;

            //load the specified asset into memory
            loadedAsset = thisAssetBundle.LoadAsset(asset, typeof(GameObject));

            www.Dispose();

            isDone = true;
        }
    }
开发者ID:V3SUV1US,项目名称:unturned,代码行数:30,代码来源:LoadAssetFromBundle.cs

示例10: LoadAsset

    public static GameObject LoadAsset(AssetBundle bundle, string name)
    {
#if UNITY_5
        return bundle.LoadAsset(name, typeof(GameObject)) as GameObject;
#else
        return bundle.Load(name, typeof(GameObject)) as GameObject;
#endif
    }
开发者ID:shiqinghui,项目名称:LuaSpaceShoot,代码行数:8,代码来源:Util.cs

示例11: ChangeModuleStyle

    /* ChangeModuleStyle(int idx)
     * Changement de style d'un module par le idx ième
     * */
    public IEnumerator ChangeModuleStyle(int idx, bool bsensfacade=false)
    {
        string newStyle = _tmpStylesNames[idx];
        string newTag = _currentModule.GetModuleType().ToString()+"_t"+_currentModule.GetSize()+"_"+newStyle;
        if(newStyle != _currentModule.GetStyle())
        {
            //Récupére le GameObject du nouveau style
            GameObject go = null;
            bool bextrem = false;
            //--vv--Copie un module éxistant pour éviter de réouvrir l'assetBundle--vv--
        //			foreach(DynShelterModule dsMod in _modules)
        //			{
        //				if(dsMod.GetTag() == newTag)
        //				{
        //					go = (GameObject)Instantiate(dsMod.GetGameObj());
        //					break;
        //				}
        //			}

            //--vv--Si il na pas deja été créé, ben tant pis on ouvre--vv--
        //			if(go == null)
        //			{
        //				OSLib libObj = GetComponent<ObjData>().GetObjectModel().GetLibrary();
                WWW www = WWW.LoadFromCacheOrDownload (_lib.GetAssetBundlePath (), _lib.GetVersion ());
                yield return www;
                if (www.error != null)
                {
                    Debug.Log ("AssetBundle ERROR" + www.error);
                }
                else
                {
                    _assetBundle = www.assetBundle;
                    if (_assetBundle != null)
                    {

                    string sz = newTag;
                        if(sz.Contains("extrem"))
                        {
                            bextrem = true;
                        }

                        Debug.Log("assetBundle.load  : "+newTag);
                        Object original = _assetBundle.LoadAsset (newTag, typeof(GameObject));

                        go = (GameObject) Instantiate (original);
                    }
                    _assetBundle.Unload (false);
                }
                www.Dispose();
        //			}
            SaveTransform();
            go.transform.parent = transform;
            go.transform.localRotation = _currentModule.GetGameObj().transform.localRotation;//Quaternion.identity;
            go.transform.localScale = Vector3.one;

            if(bextrem)
            {
                if(bsensfacade)
                {
                    go.transform.rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f);
                    //go.transform.Rotate(0.0f, 180.0f, 0.0f);
                }

                _currentModule.bextrem = true;
            }
            else
            {
                _currentModule.bextrem = false;
            }

            if(!IsAbrifixe())
            {
                go.transform.localPosition = _currentModule.GetPos();
                _modManager.TestModuleForGlobalMods(go);
                _modManager.RemoveModFrom(_currentModule.GetGameObj());
                Destroy(_currentModule.GetGameObj());
                _currentModule.ChangeStyle(newStyle,go);
                _modules[_selectedIndex] = _currentModule;
                //ChangeModuleColor(_currentColor);
            }
            else
            {
                int curMod=0;
                //foreach(DynShelterModule m in _modules)
                for(int modulIndex=0;modulIndex<_modules.Count;modulIndex++)
                {
                    DynShelterModule m = (DynShelterModule) _modules[modulIndex];
                    if(m.GetModuleType()==_currentModule.GetModuleType())
                    {
                        GameObject goCopy = (GameObject)Instantiate(go);
                        goCopy.transform.parent = transform;
                        goCopy.transform.localPosition = m.GetPos();
                        _modManager.TestModuleForGlobalMods(goCopy);
                        _modManager.RemoveModFrom(m.GetGameObj());
                        Destroy(m.GetGameObj());
                        m.ChangeStyle(newStyle,goCopy);
                        _modules[modulIndex] = m;
//.........这里部分代码省略.........
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:101,代码来源:FunctionConf_Dynshelter.cs

示例12: LoadConf

    //--------------COROUTINES-----------------------------------
    /* LoadConf()
     * Chargement de la configuration d'abri par défaut
     **/
    private IEnumerator LoadConf()
    {
        _isBuilding = true;
        Montage.assetBundleLock = true;
        //Attend que le objdata soit configuré
        while(gameObject.GetComponent<ObjData>()==null)
        {
                yield return new WaitForEndOfFrame();
        }
            while(gameObject.GetComponent<ObjData>().GetObjectModel() == null)
            {
                yield return new WaitForEndOfFrame();
            }
        _lib = GetComponent<ObjData>().GetObjectModel().GetLibrary();
        //Récupération de l'assetbundle
        //		OSLib libObj = GetComponent<ObjData>().GetObjectModel().GetLibrary();
        WWW www = WWW.LoadFromCacheOrDownload (_lib.GetAssetBundlePath (), _lib.GetVersion ());
        yield return www;

        if (www.error != null)
        {
            Debug.Log ("AssetBundle ERROR" + www.error);
        }
        else
        {
            _assetBundle = www.assetBundle;
            if (_assetBundle != null)
            {
                //Chargement de la config
                TextAsset confXml = _assetBundle.LoadAsset (modelName+"_conf", typeof (TextAsset)) as TextAsset;
                if (confXml != null)
                {
                    _dsMdl.ParseConfFile(confXml);
                }

            }
            _assetBundle.Unload (false);
        }
        www.Dispose();

        //Création de l'abri par default
        ArrayList stConf= _dsMdl.GetdefaultConf();
        _currentColor = _dsMdl.GetColor(_currentColorIndex);

        if(stConf.Count > 0)
        {
        //			SaveTransform();
            _hasFacadeInDefaultBegin = false;
            _hasFacadeInDefaultEnd = false;
            for(int i=0;i<stConf.Count;i=i+3)
            {
                ModuleType typ = ModuleType.bloc;
                switch ((string)stConf[i])
                {
                case "facade":
                    typ = ModuleType.facade;
                    break;
                case "bloc":
                    typ = ModuleType.bloc;
                    if(IsAbrifixe())
                    {
                        typ = ModuleType.multiBloc;
                    }
                    break;
                case "extremite":
                    typ = ModuleType.extremite;
                    break;
                case "multibloc":
                    typ = ModuleType.multiBloc;
                    break;
                }

                if((typ == ModuleType.facade) && (i==0))
                {
                    _hasFacadeInDefaultBegin = true;
                    _saveTailleBegin = (int) stConf[i+1];
                    _saveStyleBegin = (string) stConf[i+2];
                    continue;
                }
                if((typ == ModuleType.facade) && (i>0))
                {
                    _hasFacadeInDefaultEnd = true;
                    _saveTailleEnd = (int) stConf[i+1];
                    _saveStyleEnd = (string) stConf[i+2];
                    continue;
                }

                int t = (int) stConf[i+1];

                string styl = (string) stConf[i+2];

                _nextInsertion = true;
                _decalZ = 0.0f;
                yield return StartCoroutine(AddModule(t,styl,typ,/*_dsMdl.GetColor(0)*/_currentColor,true));

            }
//.........这里部分代码省略.........
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:101,代码来源:FunctionConf_Dynshelter.cs

示例13: AddModule

    public IEnumerator AddModule(int size,string style,ModuleType typ,Color32 color,bool fromInit=false, bool bsensfacade=false)
    {
        //Debug.Log("t : "+size+", styl : "+style+",ModuleType : "+ typ.ToString()+", bool "+fromInit);

        bool noNeedLimitToBeRecalculate = fromInit;
        _isBuilding = true;
        //-------vv-Récupération du mesh-vv------------
        DynShelterModule newModule = null;
        string newStyle= string.Copy(style);
        string tag = CheckAndCreateTag(size,style,typ,out newStyle);
        style = string.Copy(newStyle);

        GameObject go = null;
        bool bextrem = false;

        //--vv--Si il na pas deja été créé, ben tant pis on ouvre--vv--
        if(go == null)
        {
        //			OSLib libObj = GetComponent<ObjData>().GetObjectModel().GetLibrary();
            WWW www = WWW.LoadFromCacheOrDownload (_lib.GetAssetBundlePath (), _lib.GetVersion ());
            yield return www;
            if (www.error != null)
            {
                Debug.Log ("AssetBundle ERROR" + www.error);
            }
            else
            {
                _assetBundle = www.assetBundle;
                if (_assetBundle != null)
                {
                    string sz = _assetBundle.name;

                    if(sz.Contains("extrem"))
                    {
                        bextrem = true;
                    }

                //	Debug.Log("assetBundle.load  : "+tag);
                    Object original = _assetBundle.LoadAsset (tag, typeof(GameObject));
                    if(original!=null){
                        go = (GameObject) Instantiate (original);
                    }
                    /*else
                    {

                        _assetBundle.Unload (false);
                        www.Dispose();
                    }*/

                }
                _assetBundle.Unload (false);
            }
            www.Dispose();
        }

        //-------vv-Création du module-vv---------------
        switch(typ)
        {
        case ModuleType.bloc:
            newModule = new DynShelterBloc(size,style,typ,color,this);
            break;
        case ModuleType.facade:
            noNeedLimitToBeRecalculate=true;
            newModule = new DynShelterFacade(size,style,typ,color,this);
            m_icounterFacade++;
            break;
        case ModuleType.extremite:
            newModule = new DynShelterExtrem(size,style,typ,color,this);
            break;
        case ModuleType.multiBloc:
            newModule = new DynShelterMultiBloc(size,style,ModuleType.bloc,color,this);
            if(_currentModule==null)
            {
                break;
            }
            if(_currentModule.GetType() == typeof(DynShelterBloc))
            {
                DynShelterMultiBloc newCurrent = new DynShelterMultiBloc((DynShelterBloc)_currentModule);
                foreach(DynShelterModule dm in _modules)
                {
                    if(dm.GetPrevModule() == _currentModule)
                        dm.SetPrevModule(newCurrent);
                    if(dm.GetNextModule() == _currentModule)
                        dm.SetNextModule(newCurrent);
                }

                _currentModule = newCurrent;
                _modules[_selectedIndex] = _currentModule;
            }
            else
            {
                if(_currentModule.GetPrevModule() != null)
                {
                    if(_currentModule.GetPrevModule().GetSize() == size && _currentModule.GetPrevModule().GetType() == typeof(DynShelterBloc))
                    {
                        Debug.Log("Modifying Prev");
                        DynShelterMultiBloc newPrev = new DynShelterMultiBloc((DynShelterBloc)_currentModule.GetPrevModule());
                        int idx = _modules.IndexOf(_currentModule.GetPrevModule());
                        _modules[idx] = newPrev;
                        _currentModule.SetNextModule(newPrev);
//.........这里部分代码省略.........
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:101,代码来源:FunctionConf_Dynshelter.cs

示例14: LoadZombieModel

    IEnumerator LoadZombieModel()
    {
        string bundleName = "zombie_model";
        string assetName = "zombie";
        string url = string.Format("file://{0}/{1}/{2}", Application.dataPath, bundlePath, bundleName);

        WWW www = WWW.LoadFromCacheOrDownload(url, 0);
        yield return www;

        if(!string.IsNullOrEmpty(www.error))
        {
            Debug.LogError(www.error);
            return false;
        }

        downloadedAB = www.assetBundle;
        if (downloadedAB == null)
        {
            Debug.LogError("can't load assetbundle");
            return false;
        }

        loadedModel_ = downloadedAB.LoadAsset (assetName) as GameObject;
        Debug.Log ("Model| instanceID: " + loadedModel_.GetInstanceID ());
        Debug.Log ("Model| Animator instanceID: " + loadedModel_.GetComponent<Animator> ().GetInstanceID ());
        Debug.Log ("Model| Avatar instanceID: " + loadedModel_.GetComponent<Animator> ().avatar.GetInstanceID ());
        Debug.Log ("---------------------------------------------------");

        //downloadedAB.LoadAsset (assetName);
    }
开发者ID:ylyking,项目名称:NewABSystem,代码行数:30,代码来源:LoadAB.cs


注:本文中的AssetBundle.LoadAsset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。