private IEnumerator AsyncLoadAsset(ABLoadTask task) { ResourceRequest request; if (null == task.AbType) { request = Resources.LoadAsync(ABHelper.GetFileFullPathWithoutFtype(task.AbPath)); } else { request = Resources.LoadAsync(ABHelper.GetFileFullPathWithoutFtype(task.AbPath), task.AbType); } while (!request.isDone) { if (null != task.Progress) { task.Progress(request.progress); } yield return(null); } yield return(request); // 加载完成 if (request.isDone) { LoadComplete(request.asset, task); } }
private IEnumerator AsyncLoadAsset(ABReference abRef, ABLoadTask task) { AssetBundleRequest request; if (null != task.AbType) { request = abRef.TheAB.LoadAssetAsync(task.AbName, task.AbType); } else { request = abRef.TheAB.LoadAssetAsync(task.AbName); } while (!request.isDone) { if (null != task.Progress) { task.Progress(request.progress); } yield return(null); } yield return(request); // 加载完成 if (request.isDone) { UnityEngine.Object spawner = request.asset; abRef.ReferenceAsc(); LoadComplete(spawner, task); } }
private IEnumerator AsyncLoadAsset(ABReference abRef, ABLoadTask task) { if (null == abRef.TheAB) { abRef.ReferenceAsc(); LoadComplete(null, task); yield break; } AssetBundleRequest request; if (null != task.AbType) { request = abRef.TheAB.LoadAssetAsync(task.AbName, task.AbType); } else { request = abRef.TheAB.LoadAssetAsync(task.AbName); } while (!request.isDone) { if (null != task.Progress) { task.Progress(request.progress); } yield return(null); } yield return(request); // 加载完成 if (request.isDone) { abRef.ReferenceAsc(); LoadComplete(request.asset, task); } }