예제 #1
0
        private IEnumerator WaitToLoadBundle()
        {
            string name = inputLoadBundleName.text;
            AssetBundleLoadOperation operation = AssetBundleLoader.LoadAsync(name);

            yield return(operation);

            if (!operation.isError && operation.isDone)
            {
                Debug.LogFormat("'{0}' 载入成功", operation.assetBundleName);
            }
        }
예제 #2
0
        /// <summary>
        /// 异步加载AssetBundle
        /// </summary>
        /// <param name="assetBundleName"></param>
        /// <returns></returns>
        public static AssetBundleLoadOperation LoadAsync(string assetBundleName)
        {
            if (!CheckInitialize())
            {
                return(null);
            }

            //创建一个读取作业
            AssetBundleLoadOperation operation = new AssetBundleLoadOperation(assetBundleName);

            m_InProgressLoadOpertaions.Add(operation);

            //下载相应的assetbundle
            DownLoadAssetBundle(assetBundleName);
            return(operation);
        }