BundleRequest.cs 736 B

123456789101112131415161718192021222324252627282930
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BundleRequest : AssetRequest
  5. {
  6. public string assetBundleName { get; set; }
  7. public AssetBundle assetBundle
  8. {
  9. get { return asset as AssetBundle; }
  10. internal set { asset = value; }
  11. }
  12. internal override void Load()
  13. {
  14. asset = AssetBundle.LoadFromFile(name);
  15. if (assetBundle == null)
  16. error = name + " LoadFromFile failed.";
  17. LoadState = AssetLoadState.Loaded;
  18. }
  19. internal override void Unload()
  20. {
  21. if (assetBundle == null)
  22. return;
  23. assetBundle.Unload(true);
  24. assetBundle = null;
  25. LoadState = AssetLoadState.Unload;
  26. }
  27. }