AssetBundleExporterUI.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine;
  2. using UnityEditor;
  3. public class AssetBundleExporterUI : EditorWindow
  4. {
  5. // Add menu named "My Window" to the Window menu
  6. [MenuItem ("AV/Asset Bundle Exporter")]
  7. static void Init()
  8. {
  9. // Get existing open window or if none, make a new one:
  10. EditorWindow.GetWindow(typeof(AssetBundleExporterUI));
  11. }
  12. void OnGUI()
  13. {
  14. EditorGUILayout.HelpBox("You will need to switch to each platform, and press the button below to build asset bundles for each platform. To avoid reimporting all assets everytime, it is suggested to exit Unity and swap out the Library folder with the Library folder used with a different platform setting for faster switching, or have a Unity project for each platform and just open each one manually.", MessageType.Warning);
  15. if (GUILayout.Button("Build Asset Bundles For "+GetPlatform()))
  16. {
  17. AssetBundleExporter.Export();
  18. }
  19. }
  20. string GetPlatform()
  21. {
  22. #if UNITY_IPHONE
  23. return "iOS";
  24. #elif UNITY_ANDROID
  25. return "Android";
  26. #elif UNITY_WEBPLAYER
  27. return "WebPlayer";
  28. #else
  29. AVDebug.LogError("Unsupport platform for exporting asset bundles");
  30. return "Unsupported!!!";
  31. #endif
  32. }
  33. }