GetLoadedAssetBundle() static public method

static public GetLoadedAssetBundle ( string assetBundleName, string &error ) : LoadedAssetBundle
assetBundleName string
error string
return LoadedAssetBundle
Exemplo n.º 1
0
        public void LateTick()
        {
            bool manifestLoaded = loadOperation == null || loadOperation.IsDone();

            if (!manifestLoaded)
            {
                return;
            }

            if (bundlesToLoad.Count == 0)
            {
                tickableManager.RemoveLate(this);
                isInitialized = true;
                OnInitialized(EventArgs.Empty);
                return;
            }

            if (loadingNowBundle != null)
            {
                string error;
                if (AssetBundleManager.GetLoadedAssetBundle(loadingNowBundle, out error) != null)
                {
                    loadingNowBundle = null;
                }
            }

            loadingNowBundle = bundlesToLoad.Dequeue();
            AssetBundleManager.LoadAssetBundle(loadingNowBundle);
        }
Exemplo n.º 2
0
    public override bool Update()
    {
        if (request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out downloadingError);

        if (bundle != null)
        {
            if (string.IsNullOrEmpty(assetName))
            {
                request = bundle.assetBundle.LoadAllAssetsAsync();
            }
            else
            {
                request = bundle.assetBundle.LoadAssetAsync(assetName, type);
            }

            return(false);
        }
        else
        {
            return(true);
        }
    }
    public override bool SetRequest()
    {
        if (m_Request != null)
        {
            return(false);
        }
        Debug.Log(m_AssetBundleName + "  /   " + m_LevelName);
        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (m_IsAdditive)
            {
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Additive);
            }
            else
            {
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Single);
            }
            return(false);
        }
        else
        {
//            Debug.Log("현재 씬 로드된 에셋번들 이름 : " + bundle.m_AssetBundle.name);
            return(true);
        }
    }
Exemplo n.º 4
0
    public override bool Update()
    {
        if (m_sceneRequest != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName);

        if (bundle != null)
        {
            if (m_IsAdditive)
            {
                m_sceneRequest = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Additive);
            }
            else
            {
                m_sceneRequest = SceneManager.LoadSceneAsync(m_LevelName);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            //m_Request = SceneManager.LoadSceneAsync(m_LevelName, m_IsAdditive?LoadSceneMode.Additive:LoadSceneMode.Single);

            if (m_IsAdditive)
            {
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Additive);
            }

            else
            {
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Single);
            }

            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 6
0
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName);

        if (bundle != null)
        {
            if (m_IsSingle)
            {
                m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
            }
            else
            {
                m_AllRequest = bundle.m_AssetBundle.LoadAllAssetsAsync(m_Type);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 7
0
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (bundle.m_AssetBundle == null)
            {
                Debug.LogError(string.Format("AssetBundle : {0}, AssetName : {1} load error", m_AssetBundleName, m_AssetName));
                Debug.LogError(string.Format("ErrorMessage : {0}", (m_DownloadingError == null) ? string.Empty : m_DownloadingError));
            }
            else
            {
                m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 8
0
        public T LoadAsset <T>(string bundleName, string assetName, string assetFullPath) where T : UnityEngine.Object
        {
#if UNITY_EDITOR
            if (AssetBundleManager.SimulateAssetBundleInEditor == false)
#else
            if (true)
#endif
            {
                string            errMessage  = "";
                LoadedAssetBundle assetBundle = AssetBundleManager.GetLoadedAssetBundle(bundleName, out errMessage);
                if (assetBundle != null)
                {
                    T result = (T)assetBundle.m_AssetBundle.LoadAsset(assetName, typeof(T)) as T;
                    return(result);
                }
                else
                {
                    Debug.LogError(errMessage);
                }
            }
#if UNITY_EDITOR
            else
            {
                var loadedObject = AssetDatabase.LoadAssetAtPath <T>(assetFullPath);
                if (loadedObject == null)
                {
                    Debug.LogErrorFormat("Load Asset At Path Failed : {0}", assetFullPath);
                }

                return(loadedObject);
            }
#endif
            Debug.LogErrorFormat("Type <T> LoadAsset Function Load Failed : {0}", assetName);
            return(null);
        }
Exemplo n.º 9
0
    protected IEnumerator LoadScript(string assetBundleName, string assetName)
    {
        // This is simply to get the elapsed time for this phase of AssetLoading.
        float startTime = Time.realtimeSinceStartup;

        // Load asset from assetBundle.
        AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject));

        if (request == null)
        {
            yield break;
        }
        yield return(StartCoroutine(request));//开启协程;

        string            error;
        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out error);

        if (bundle != null)
        {
            string tempStr = bundle.m_AssetBundle.LoadAsset <TextAsset>(assetName).text;
            luaenv.DoString(tempStr);
        }


        float elapsedTime = Time.realtimeSinceStartup - startTime;

        Debug.Log(assetName + (bundle == null ? " was not" : " was") + " loaded successfully in " + elapsedTime + " seconds");
    }
Exemplo n.º 10
0
    protected IEnumerator InstantiateImageAsync(string assetBundleName, string assetName)
    {
        // This is simply to get the elapsed time for this phase of AssetLoading.
        float startTime = Time.realtimeSinceStartup;

        // Load asset from assetBundle.
        AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject));

        if (request == null)
        {
            yield break;
        }
        yield return(StartCoroutine(request));//开启协程;

        string            error;
        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out error);

        if (bundle != null)
        {
            texture_ = bundle.m_AssetBundle.LoadAsset <Texture2D>(assetName);                 //用GUI显示;

            Sprite st = Sprite.Create(texture_, new Rect(0, 0, texture_.width, texture_.height), Vector2.zero);
            showImage.sprite = st;                                                           //用UI Image显示;
        }


        // Calculate and display the elapsed time.
        float elapsedTime = Time.realtimeSinceStartup - startTime;

        Debug.Log(assetName + (bundle == null ? " was not" : " was") + " loaded successfully in " + elapsedTime + " seconds");
    }
Exemplo n.º 11
0
    public override bool Update()
    {
        if (request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out downloadError);

        if (bundle != null)
        {
            if (isAdditive)
            {
                request = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(levelName, UnityEngine.SceneManagement.LoadSceneMode.Additive);
            }
            else
            {
                request = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(levelName, UnityEngine.SceneManagement.LoadSceneMode.Single);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 12
0
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (m_IsAdditive)
            {
                m_Request = Application.LoadLevelAdditiveAsync(m_LevelName);
            }
            else
            {
                m_Request = Application.LoadLevelAsync(m_LevelName);
            }
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 13
0
 static public int GetLoadedAssetBundle_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         System.String a1;
         checkType(l, 1, out a1);
         var ret = AssetBundleManager.GetLoadedAssetBundle(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (string.IsNullOrEmpty(m_AssetName))
            {
                string[] allAssetNames = bundle.m_AssetBundle.GetAllAssetNames();
                if (allAssetNames != null && allAssetNames.Length > 0)
                {
                    m_Request = bundle.m_AssetBundle.LoadAssetWithSubAssetsAsync(allAssetNames[0]);
                }
                // m_Request = bundle.m_AssetBundle.LoadAllAssetsAsync();
            }
            else
            {
                m_Request = bundle.m_AssetBundle.LoadAssetWithSubAssetsAsync(m_AssetName, m_Type);
            }

            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 15
0
    public Object LoadResource(string levelName)
    {
        Object obj = null;

#if UNITY_EDITOR
        if (AssetBundleManager.SimulateAssetBundleInEditor)
        {
            AssetBundleLoadAssetOperation request = AssetBundleManager.LoadAssetAsync(ASSET_BUNDLE_RESOURCES, levelName, typeof(Object));
            if (request == null)
            {
                Debug.Log("LoadResource error:" + levelName);
                return(null);
            }
            obj = request.GetAsset <Object>();
        }
        else
#endif
        {
            string            error;
            LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(ASSET_BUNDLE_RESOURCES, out error);
            if (bundle == null || !string.IsNullOrEmpty(error))
            {
                Debug.Log("LoadResource error:" + levelName + " >> " + error);
                return(null);
            }
            obj = bundle.m_AssetBundle.LoadAsset <Object>(levelName);
        }
        return(obj);
    }
Exemplo n.º 16
0
    public void GetAssetFromLoadedBundle <T>(string assetBundleName, string assetName,
                                             out string error, Action <T> onSuccess)
        where T : UnityEngine.Object
    {
        var bundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out error);

        GetAssetFromLoadedBundle <T>(bundle, assetName, onSuccess);
    }
Exemplo n.º 17
0
        /// <summary>
        /// Updates the list of downloadingItems, checks if any have finished downloading and if they have triggers the RemoveDownload method on them
        /// </summary>
        public void Update()
        {
            List <DownloadingAssetItem> finishedItems = new List <DownloadingAssetItem>();

            if (downloadingItems.Count > 0)
            {
                areDownloadedItemsReady = false;
                List <string> finishedBundles = new List <string>();
                foreach (DownloadingAssetItem dli in downloadingItems)
                {
                    bool canProcessBatch = true;
                    dli.UpdateProgress();
                    string error = "";
                    if (finishedBundles.Contains(dli.containingBundle))
                    {
                        if (dli.flagForRemoval == false)
                        {
                            dli.flagForRemoval = true;
                        }
                        else
                        {
                            if (dli.isBeingRemoved)
                            {
                                canProcessBatch = false;
                            }
                        }
                    }
                    else if (AssetBundleManager.GetLoadedAssetBundle(dli.containingBundle, out error) != null)
                    {
                        finishedBundles.Add(dli.containingBundle);
                        if (dli.flagForRemoval == false)
                        {
                            dli.flagForRemoval = true;
                        }
                        else
                        {
                            if (dli.isBeingRemoved)
                            {
                                canProcessBatch = false;
                            }
                        }
                    }
                    else
                    {
                        canProcessBatch = false;
                    }
                    if (canProcessBatch)
                    {
                        finishedItems.Add(dli);
                    }
                }
            }
            //send the finished downloads to be processed
            if (finishedItems.Count > 0)
            {
                DynamicAssetLoader.Instance.StartCoroutine(RemoveDownload(finishedItems));
            }
        }
Exemplo n.º 18
0
    /// <summary>
    /// 어셋번들에서 게임오브젝트(프리팹) 불러오기
    /// </summary>
    /// <param name="assetBundleName">어셋번들 이름</param>
    /// <param name="assetName">프리팹 이름</param>
    /// <param name="result">Instantiate한 게임오브젝트 반환함. 람다식으로 잘 참조해서 쓸 것</param>
    /// <returns></returns>
    public IEnumerator InstantiateGameObjectAsync(string assetBundleName, string assetName, System.Action <GameObject> result)
    {
        //GameObject prefab = null;

        if (string.IsNullOrEmpty(assetBundleName) || string.IsNullOrEmpty(assetName))
        {
            Debug.LogWarning("assetBundleName or assetName is empty");
            result(null);
            yield break;
        }

        if (!isInitialized)
        {
            yield return(StartCoroutine(Initialize()));
        }

        string            errorString;
        LoadedAssetBundle loadedAssetBundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out errorString);

        //Debug.Log(errorString);
        if (loadedAssetBundle != null)
        {
            AssetBundleRequest request = loadedAssetBundle.m_AssetBundle.LoadAssetAsync(assetName, typeof(GameObject));
            while (!request.isDone)
            {
                yield return(null);
            }

            GameObject go = Instantiate(request.asset as GameObject);

            result(go);
            yield break;
        }

        AssetBundleLoadAssetOperation r = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject));


        if (r == null)
        {
            result(null);
            yield break;
        }

        yield return(StartCoroutine(r));

        GameObject obj = r.GetAsset <GameObject>();

        //yield return StartCoroutine(LoadGameObjectAsync(assetBundleName, assetName, x => prefab = x));

        if (obj != null)
        {
            result(GameObject.Instantiate(obj));
        }
        else
        {
            result(null);
        }
    }
Exemplo n.º 19
0
        public static T ManualLoadAsset <T>(string bundle, string asset, string manifest) where T : Object
        {
            AssetBundleManager.LoadAssetBundleInternal(bundle, false, manifest);
            var assetBundle = AssetBundleManager.GetLoadedAssetBundle(bundle, out string error, manifest);

            T output = assetBundle.m_AssetBundle.LoadAsset <T>(asset);

            return(output);
        }
 public override bool Update()
 {
     if (this.m_Request != null)
     {
         return(false);
     }
     if (AssetBundleManager.GetLoadedAssetBundle(this.m_AssetBundleName, out this.m_DownloadingError, this.m_ManifestAssetBundleName) == null)
     {
         return(true);
     }
     this.m_Request = SceneManager.LoadSceneAsync(this.m_LevelName, !this.m_IsAdditive ? (LoadSceneMode)0 : (LoadSceneMode)1);
     return(false);
 }
Exemplo n.º 21
0
 private void Update()
 {
     UpdateRequest();
     if (_requestOpreList.Count > 0)
     {
         for (int i = 0; i < _requestOpreList.Count;)
         {
             var opre = _requestOpreList[i];
             if (opre is ResUnloadOpreation)
             {
                 var    unOpre = opre as ResUnloadOpreation;
                 string error  = string.Empty;
                 var    ab     = AssetBundleManager.GetLoadedAssetBundle(unOpre.abName, out error);
                 if (ab != null && string.IsNullOrEmpty(error))
                 {
                     //load done
                     if (ab.m_AssetBundle != null)
                     {
                         if (OnProcessUnLoadRes(unOpre.res, unOpre.abName, unOpre.resName))
                         {
                             AssetBundleManager.UnloadAssetBundle(unOpre.abName);
                             _zeroRef.Remove(MakeKey(unOpre.abName, unOpre.resName));
                         }
                         _requestOpreList.RemoveAt(i);
                     }
                     else
                     {
                         i++;
                     }
                 }
                 else
                 {
                     _requestOpreList.RemoveAt(i);
                 }
             }
             else
             {
                 if (opre.opera.IsDone())
                 {
                     OnLoadDone(opre);
                     _requestOpreList.RemoveAt(i);
                 }
                 else
                 {
                     i++;
                 }
             }
         }
     }
 }
Exemplo n.º 22
0
    public override bool Update()
    {
        if (this.m_Request != null)
        {
            return(false);
        }
        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName);

        if (bundle != null)
        {
            m_Request = SceneManager.LoadSceneAsync(m_LevelName);
            return(false);
        }
        return(true);
    }
    public override bool Update()
    {
        if (this.m_Request != null)
        {
            return(false);
        }
        LoadedAssetBundle loadedAssetBundle = AssetBundleManager.GetLoadedAssetBundle(this.m_AssetBundleName, out this.m_DownloadingError, this.m_ManifestAssetBundleName);

        if (loadedAssetBundle == null)
        {
            return(true);
        }
        if (Object.op_Implicit((Object)loadedAssetBundle.m_AssetBundle))
        {
            this.m_Request = !this.m_AssetName.IsNullOrEmpty() ? loadedAssetBundle.m_AssetBundle.LoadAssetAsync(this.m_AssetName, this.m_Type) : loadedAssetBundle.m_AssetBundle.LoadAllAssetsAsync(this.m_Type);
        }
        return(false);
    }
Exemplo n.º 24
0
        private LoadedAssetBundle GetLoadedBundle(string bundle)
        {
            string error;
            var    loaded = AssetBundleManager.GetLoadedAssetBundle(bundle, out error);

            if (!string.IsNullOrEmpty(error))
            {
                Debug.LogError(error + " in bundle: " + bundle);
                return(null);
            }

            if (loaded == null || loaded.m_AssetBundle == null)
            {
                Debug.LogError("Cannot find bundle with name: " + bundle);
                return(null);
            }

            return(loaded);
        }
Exemplo n.º 25
0
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 26
0
    static public GameObject InstantiateGameObject(string assetBundleName, string assetName)
    {
        //GameObject prefab = null;

        if (string.IsNullOrEmpty(assetBundleName) || string.IsNullOrEmpty(assetName))
        {
            Debug.LogWarning("assetBundleName or assetName is empty");
            return(null);
        }

        if (!Instance.isInitialized)
        {
            return(null);
        }

        Instance.StartCoroutine(Instance.Initialize());

        string            errorString;
        LoadedAssetBundle loadedAssetBundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out errorString);

        //Debug.Log(errorString);
        if (loadedAssetBundle != null)
        {
            Object request = loadedAssetBundle.m_AssetBundle.LoadAsset(assetName, typeof(GameObject));

            GameObject go = Instantiate(request as GameObject);

            return(go);
        }

        //return null;

        AssetBundleLoadAssetOperation r = AssetBundleManager.LoadAssetAsync(assetBundleName, assetName, typeof(GameObject));

        if (r == null)
        {
            return(null);
        }

        GameObject obj = r.GetAsset <GameObject>();

        return(Instantiate(obj));
    }
Exemplo n.º 27
0
            public static T ManualLoadAsset <T>(string bundle, string asset, string manifest) where T : Object
            {
                return(IllusionMods.AssetLoader.ManualLoadAsset <T>(bundle, asset, manifest));

#if false
                LoadedBundles.Add(bundle);
#if AI
                return(AssetUtility.LoadAsset <T>(bundle, asset, manifest));
#else
#if HS
                var _ = asset;
                _ = manifest;
                return(null);
#else
                manifest = manifest.IsNullOrEmpty() ? null : manifest;
                Logger.DebugLogDebug($"ManualLoadAsset: {bundle}, {asset}, {manifest}");
                try
                {
                    var result = CommonLib.LoadAsset <T>(bundle, asset, false, manifest);
                    AssetBundleManager.UnloadAssetBundle(bundle, true, manifest);
                    return(result);
                }
                catch
                {
#if HS2
                    throw;
#else
                    AssetBundleManager.LoadAssetBundleInternal(bundle, false, manifest);
                    var assetBundle = AssetBundleManager.GetLoadedAssetBundle(bundle, out var error, manifest);
                    if (!string.IsNullOrEmpty(error))
                    {
                        Logger?.LogError($"ManualLoadAsset: {error}");
                    }

                    var result = assetBundle.m_AssetBundle.LoadAsset <T>(asset);
                    return(result);
#endif
                }
#endif
#endif
#endif
            }
Exemplo n.º 28
0
    // Returns true if more Update calls are required.
    public override bool SetRequest()
    {
        if (m_Request != null)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            ///@TODO: When asset bundle download fails this throws an exception...
            m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
            return(false);
        }
        else
        {
            return(true);
        }
    }
Exemplo n.º 29
0
    // Load level from the given assetBundle.
    static public void LoadLevel(string assetBundleName, string levelName, bool isAdditive)
    {
#if UNITY_EDITOR
        if (SimulateAssetBundleInEditor == LoadMode.AssetBundleName)
        {
            //GetAssetPathsFromAssetBundleAndAssetName接口对大小写敏感
            assetBundleName = assetBundleName.ToLower();
            levelName = levelName.ToLower();

            string[] levelPaths = AssetDatabase.GetAssetPathsFromAssetBundleAndAssetName(assetBundleName, levelName);
            if (levelPaths.Length == 0)
            {
                ///@TODO: The error needs to differentiate that an asset bundle name doesn't exist
                //        from that there right scene does not exist in the asset bundle...

                Debug.LogError("There is no scene with name \"" + levelName + "\" in " + assetBundleName);
            }

            if (isAdditive)
                EditorApplication.LoadLevelAdditiveInPlayMode(levelPaths[0]);
            else
                EditorApplication.LoadLevelInPlayMode(levelPaths[0]);

        }
        else
#endif
        {
            AssetBundle assetbundle = LoadAssetBundleImmediately(assetBundleName);
            string m_DownloadingError;
            LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(assetbundle.name, out m_DownloadingError);
            if (bundle != null)
            {
                if (isAdditive)
                    SceneManager.LoadScene(levelName,LoadSceneMode.Additive);
                else
                    SceneManager.LoadScene(levelName,LoadSceneMode.Single);
            }
        }

    }
Exemplo n.º 30
0
    // Returns true if more Update calls are required.
    public override bool Update()
    {
        if (m_bRequest == true)
        {
            return(false);
        }

        LoadedAssetBundle bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);

        if (bundle != null)
        {
            if (m_listAsset != null)
            {
                for (int i = 0; i < m_listAsset.Count; ++i)
                {
                    stAssetRequestInfo requestInfo = m_listAsset[i];
                    if (bundle.m_AssetBundle != null)
                    {
                        requestInfo.m_Request = bundle.m_AssetBundle.LoadAssetAsync(requestInfo.m_AssetName, m_Type);
                    }
                    //else
                    //    Fabric.Crashlytics.Crashlytics.Log("AssetBundleLoadAssetListOperationFull.Update : excetpion 00, assetbundle name is " + m_AssetBundleName);

                    m_listAsset[i] = requestInfo;
                }
            }
            //else
            //{
            //    Fabric.Crashlytics.Crashlytics.Log("AssetBundleLoadAssetListOperationFull.Update : exception 01, assetbundle name is " + m_AssetBundleName);
            //}

            m_bRequest = true;
            return(false);
        }
        else
        {
            return(true);
        }
    }