示例#1
0
 /// <summary>
 /// 得到本类实例
 /// </summary>
 /// <returns></returns>
 public static AssetBundleMgr GetInstance()
 {
     if (_Instance == null)
     {
         _Instance = new GameObject("AssetBundleMgr").AddComponent <AssetBundleMgr>();
     }
     return(_Instance);
 }
示例#2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         Debug.Log("卸载资源执行中");
         AssetBundleMgr.GetInstance().DisposeAllAssets(_SceneName);
     }
 }
示例#3
0
 //回调函数 所有的AB包都已经加载完毕
 void LoadAllABCompleted(string abName)
 {
     UnityEngine.Object tmpObj = null;
     tmpObj = AssetBundleMgr.GetInstance().LoadAsset(_SceneName, _AssetBundleName, _AssetName, false);
     if (tmpObj != null)
     {
         Instantiate(tmpObj);
     }
 }
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         Debug.Log("卸载资源执行中");
         AssetBundleMgr.GetInstance().DisposeAllAssets(_SceneName);
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         Debug.Log("跳转场景");
         SceneManager.LoadSceneAsync("Scene_02");
     }
 }
示例#5
0
 private void Start()
 {
     //调用AB包
     StartCoroutine(AssetBundleMgr.GetInstance().LoadAssetBundlePack(_SceneName, _AssetBundleName, LoadAllABCompleted));
 }