GetLoadedAssetBundle() public static method

public static GetLoadedAssetBundle ( string assetBundleName, string &error ) : LoadedAssetBundle
assetBundleName string
error string
return LoadedAssetBundle
        public override bool Update()
        {
            if (m_Request != null)
            {
                return(false);
            }

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

            if (bundle != null)
            {
#if UNITY_5_3 || UNITY_5_4
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, m_IsAdditive ? LoadSceneMode.Additive : LoadSceneMode.Single);
#else
                LoadSceneParameters loadparams = new LoadSceneParameters();
                if (m_IsAdditive)
                {
                    //m_Request = Application.LoadLevelAdditiveAsync(m_LevelName);
                    loadparams.loadSceneMode = LoadSceneMode.Additive;
                }
                else
                {
                    //m_Request = Application.LoadLevelAsync(m_LevelName);
                    loadparams.loadSceneMode = LoadSceneMode.Single;
                }
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, loadparams);
#endif
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #2
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 = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Additive);
                }
                else
                {
                    m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Single);
                }

                m_Request.allowSceneActivation = m_allowSceneActivation;

                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #3
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 = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Additive); // Application.LoadLevelAdditiveAsync (m_LevelName);
                }
                // 替换模式
                else
                {
                    m_Request = SceneManager.LoadSceneAsync(m_LevelName, LoadSceneMode.Single); // Application.LoadLevelAsync (m_LevelName);
                }
                // 默认为true,表示一旦场景加载完毕即刻切换场景,设置为false后不自动切换场景,在需要切换场景时,设置m_Request.allowSceneActivation = true;
                // m_Request.allowSceneActivation = false;
                // m_Request.progress 为下载进度
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #4
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 = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(m_LevelName, UnityEngine.SceneManagement.LoadSceneMode.Additive);
                }
                else
                {
                    m_Request = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(m_LevelName, UnityEngine.SceneManagement.LoadSceneMode.Single);
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #5
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)
            {
                ///@TODO: When asset bundle download fails this throws an exception...
                m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
                return(false);
            }
            else
            {
                if (Debug.developerConsoleVisible)
                {
                    Debug.LogError(m_AssetBundleName);
                }
                // CSResUpdateManager.Instance.MoveUIResource(m_AssetBundleName);
                return(true);
            }
        }
        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);
            }
        }
Beispiel #7
0
        public override bool Update()
        {
            if (m_Request != null)
            {
                return(false);
            }

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

            if (bundle != null)
            {
#if UNITY_5_3 || UNITY_5_4_OR_NEWER
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, m_IsAdditive ? LoadSceneMode.Additive : LoadSceneMode.Single);
#else
                if (m_IsAdditive)
                {
                    m_Request = Application.LoadLevelAdditiveAsync(m_LevelName);
                }
                else
                {
                    m_Request = Application.LoadLevelAsync(m_LevelName);
                }
#endif
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #8
0
        // 因为要等所有的依赖项全部加载,所以平时都不会返回false
        public override bool Update()
        {
            if (m_Request != null)
            {
                return(false);
            }

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

            if (bundle != null)
            {
                //需要检查是否加载出现异常

                ///@TODO: When asset bundle download fails this throws an exception...
                if (!string.IsNullOrEmpty(assetName))  //只下载bundle
                {
                    m_Request = bundle.m_AssetBundle.LoadAssetAsync(assetName, type);
                }
                else
                {
                    m_Request = bundle.m_AssetBundle.LoadAllAssetsAsync(type);
                }

                return(false);
            }

            if (Error != null)
            {
                return(false);
            }

            return(true);
        }
        public override bool Update()
        {
            if (m_Request != null)
            {
                return(false);
            }

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

            if (bundle != null)
            {
#if ENABLE_NDINFRA_DEBUG_INFO
                Debug.Log("AssetBundleLoadLevelOperation.Update() m_LevelName=" + m_LevelName);
#endif
                if (m_IsAdditive)
                {
                    m_Request = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(m_LevelName, UnityEngine.SceneManagement.LoadSceneMode.Additive);
                }
                else
                {
                    m_Request = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(m_LevelName);
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
 // Returns true if more Update calls are required.
 public override bool Update()
 {
     bundle = AssetBundleManager.GetLoadedAssetBundle(m_AssetBundleName, out m_DownloadingError);
     if (bundle != null)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        public override bool Update()
        {
            if (this.m_Request != null)
            {
                return(false);
            }
            LoadedAssetBundle loadedAssetBundle = AssetBundleManager.GetLoadedAssetBundle(this.m_AssetBundleName, out this.m_DownloadingError);

            if (loadedAssetBundle != null)
            {
                this.m_Request = loadedAssetBundle.m_AssetBundle.LoadAssetAsync(this.m_AssetName, this.m_Type);
                return(false);
            }
            return(string.IsNullOrEmpty(this.m_DownloadingError));
        }
		protected static void UnloadAssetBundleInternal(string assetBundleName)
		{
			string text;
			LoadedAssetBundle loadedAssetBundle = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out text);
			if (loadedAssetBundle == null)
			{
				return;
			}
			if (--loadedAssetBundle.m_ReferencedCount == 0)
			{
				AssetBundleManager.m_LoadedAssetBundles.Remove(assetBundleName);
				if (!AssetBundleManager.m_ToUnloadAssetBundles.ContainsKey(assetBundleName))
				{
					AssetBundleManager.m_ToUnloadAssetBundles.Add(assetBundleName, loadedAssetBundle);
				}
				AssetBundleManager.UnloadDependencies(assetBundleName);
			}
		}
        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);
            }
        }
Beispiel #14
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)
            {
                ///@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);
            }
        }
Beispiel #15
0
        // Returns true if more Update calls are required.
        public override bool Update()
        {
            if (isGetBundle)
            {
                return(false);
            }

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

            Debuger.Log(" load res " + m_AssetBundleName);
            if (bundle != null)
            {
                isGetBundle = true;
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #16
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)
            {
                ///@TODO: When asset bundle download fails this throws an exception...
                m_Request = bundle.m_AssetBundle.LoadAssetAsync(m_AssetName, m_Type);
                // 默认为true,表示一旦场景加载完毕即刻切换场景,设置为false后不自动切换场景,在需要切换场景时,设置m_Request.allowSceneActivation = true;
                // m_Request.allowSceneActivation = false;
                // m_Request.progress 为下载进度
                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)
            {
                //if (m_IsAdditive)
                //    m_Request = Application.LoadLevelAdditiveAsync (m_LevelName);
                //else
                //    m_Request = Application.LoadLevelAsync(m_LevelName);
                //cjh edit
                m_Request = SceneManager.LoadSceneAsync(m_LevelName, m_IsAdditive ? LoadSceneMode.Additive : LoadSceneMode.Single);
                return(false);
            }
            else
            {
                return(true);
            }
        }