예제 #1
0
        /// <summary>
        /// 获取一个资源
        /// </summary>
        /// <param name="bundlePath"></param>
        /// <param name="assetName"></param>
        /// <returns></returns>
        internal IEnumerator GetAssetAsync(string bundlePath, string assetName, AsyncOperationHandle handle)
        {
            if (string.IsNullOrWhiteSpace(assetName))
            {
                Debug.LogError("资源名为空!");
                yield break;
            }
            if (string.IsNullOrWhiteSpace(bundlePath))
            {
                bundlePath = "";
            }
            bundlePath = bundlePath.ToLower();
            assetName  = assetName.ToLower();
            if (_alreadyParseABList.Count == 0)
            {
                Log.LogWarning("没有设置任何AssetBundle的路径");
            }
            foreach (var item in _alreadyParseABList)
            {
                yield return(StartCoroutine(item.GetAssetAsync(bundlePath, assetName, handle)));

                if (handle.Result != null)
                {
                    break;
                }
            }
            handle.Invoke();
        }