12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using UnityEditor;
- public class AssetBundleExporterUI : EditorWindow
- {
- // Add menu named "My Window" to the Window menu
- [MenuItem ("AV/Asset Bundle Exporter")]
- static void Init()
- {
- // Get existing open window or if none, make a new one:
- EditorWindow.GetWindow(typeof(AssetBundleExporterUI));
- }
- void OnGUI()
- {
- 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);
- if (GUILayout.Button("Build Asset Bundles For "+GetPlatform()))
- {
- AssetBundleExporter.Export();
- }
- }
-
- string GetPlatform()
- {
- #if UNITY_IPHONE
- return "iOS";
- #elif UNITY_ANDROID
- return "Android";
- #elif UNITY_WEBPLAYER
- return "WebPlayer";
- #else
- AVDebug.LogError("Unsupport platform for exporting asset bundles");
- return "Unsupported!!!";
- #endif
- }
- }
|