IcelandicCTSBuildShortcutOverride.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Text;
  6. public class IcelandicCTSBuildShortcutOverride : MonoBehaviour
  7. {
  8. [MenuItem ("AV/Build iCTS %&b")]
  9. static void CustomBuild() {
  10. AVDebug.Log("Building version "+PlayerSettings.bundleVersion);
  11. MoveOutForAssetBundlesFolder();
  12. BuildShortcutOverride.UpdateVersionNumberFromPlayerSettings();
  13. BuildShortcutOverride.BuildCurrentPlatform();
  14. MoveBackInForAssetBundlesFolder();
  15. }
  16. static void MoveOutForAssetBundlesFolder()
  17. {
  18. //It seems NGUI widgets are still referring in serialized members to some textures/materials that
  19. //actually in asset bundles now, even though they are referring to reference atlases/fonts.
  20. //Unity thinks they should be included. So let's move them out
  21. AVDebug.Log("Moving out ForAssetBundles folder");
  22. string srcPath = Directory.GetCurrentDirectory()+"/Assets/ForAssetBundles";
  23. string destPath = Directory.GetCurrentDirectory()+"/ForAssetBundles";
  24. DirectoryInfo forAssetBundlesFolder = new DirectoryInfo(srcPath);
  25. forAssetBundlesFolder.MoveTo(destPath);
  26. FileInfo metaFile = new FileInfo(srcPath+".meta");
  27. metaFile.MoveTo(destPath+".meta");
  28. }
  29. static void MoveBackInForAssetBundlesFolder()
  30. {
  31. AVDebug.Log("Moving back in ForAssetBundles folder");
  32. string srcPath = Directory.GetCurrentDirectory()+"/ForAssetBundles";
  33. string destPath = Directory.GetCurrentDirectory()+"/Assets/ForAssetBundles";
  34. DirectoryInfo forAssetBundlesFolder = new DirectoryInfo(srcPath);
  35. forAssetBundlesFolder.MoveTo(destPath);
  36. FileInfo metaFile = new FileInfo(srcPath+".meta");
  37. metaFile.MoveTo(destPath+".meta");
  38. }
  39. }