JollM

Untitled

Jun 12th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class LoadFromCacheOrDownloadExample : MonoBehaviour
  5. {
  6. IEnumerator Start()
  7. {
  8. var www = new WWW("proper/path/to/bundle");
  9. yield return www;
  10. // server do not returns error
  11. if (www.error != null)
  12. {
  13. // Unity 5.6b9 debugs this log error(not expected, as 'error' string is null),But not Unity 5.5
  14. Debug.Log(www.error);
  15. yield return null;
  16. }
  17. if(!string.IsNullOrEmpty(www.error))
  18. {
  19. // Both Unity5.6b9 and Unity5.5 do not reach here,as expected obviously
  20. Debug.Log(www.error);
  21. }
  22. var myLoadedAssetBundle = www.assetBundle;
  23.  
  24. var asset = myLoadedAssetBundle.mainAsset;
  25.  
  26. // Unity 5.6b9 and Unity5.5 reaches here,as expected
  27. Debug.Log("Bundle Loaded");
  28. }
  29. }
Add Comment
Please, Sign In to add comment