Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1.         private IEnumerator LoadBundleFromLocal(string path, Action<AssetBundle> onComplete) {
  2.             var asyncLoad =
  3.                 AssetBundle.LoadFromFileAsync(path);
  4.  
  5.             while (!asyncLoad.isDone) {
  6.                 yield return null;
  7.             }
  8.  
  9.             onComplete(asyncLoad.assetBundle);
  10.         }
  11.  
  12.  
  13.  
  14.  
  15.  
  16. StartCoroutine(LoadBundleFromLocal(url, bundle => {
  17.                             // коллбэк тут
  18.                             if (bundle == null) {
  19.                                 Log.D($"Failed to load \"{bundleName}\" AssetBundle!");
  20.                             } else {
  21.                                 Log.D($"Bundle \"{bundleName}\" got!");
  22.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement