AssetBundleUtils.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using UnityEngine;
  2. using System.Collections;
  3. public class AssetBundleUtils
  4. {
  5. const string ASSET_BUNDLES_BASE_URL = "https://game.gamatic.com/app_condom_dk/AssetBundles/";
  6. public static string GetAssetBundlesURL()
  7. {
  8. #if UNITY_EDITOR
  9. //For editor use local version of WebPlayer
  10. return "file://"+ AssetBundleUtils.GetLocalAssetBundlesDestPath() + "WebPlayer";
  11. #else
  12. return AssetBundleUtils.ASSET_BUNDLES_BASE_URL + AssetBundleUtils.GetBuildTargetPrefix();
  13. #endif
  14. }
  15. public static string GetLocalAssetBundlesDestPath()
  16. {
  17. return Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Asset")) + "AssetBundles/";
  18. }
  19. /// <returns>
  20. /// Return the string that matches with the BuildTarget enum used when building the assetbundles
  21. /// </returns>
  22. public static string GetBuildTargetPrefix()
  23. {
  24. #if UNITY_IPHONE
  25. return "iPhone";
  26. #elif UNITY_ANDROID
  27. return "Android";
  28. #elif UNITY_WEBPLAYER
  29. return "WebPlayer";
  30. #else
  31. Debug.LogError("Selected platform not supported");
  32. return null;
  33. #endif
  34. }
  35. }