赞
踩
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.IO;
- using UnityEngine.Networking;
-
- public class LoadAssetBundle : MonoBehaviour {
-
- // Use this for initialization
- void Start () {
- //2.2 LoadFromFile 方法加载
- //AssetBundle的存放路径
- string path = "Assets/AssetBundles/sphereab.unityab";
- AssetBundle ab = AssetBundle.LoadFromFile(path);
- //取得所需要的资源
- GameObject go = ab.LoadAsset<GameObject>("Sphere");
- //加载生成到场景中
- Instantiate(go);
-
- //加载mainfest文件
- AssetBundle manifestAB = AssetBundle.LoadFromFile("Assets/AssetBundles/AssetBundles");
- AssetBundleManifest manifest = manifestAB.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
-
- foreach (string name in manifest.GetAllAssetBundles()) {
- //打印相关资源的信息
- print(name);
- }
-
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。