PostProcessorTrigger.cs 999 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEngine;
  2. using UnityEditor;
  3. using UnityEditor.Callbacks;
  4. using System.Collections;
  5. using System.Diagnostics;
  6. public static class PostBuildTrigger
  7. {
  8. #if UNITY_ANDROID
  9. [MenuItem("AV/Launch ADB Logcat", false, 0x897)]
  10. public static void LaunchAdbLogcat ()
  11. {
  12. ProcessStartInfo p = null;
  13. if (Application.platform == RuntimePlatform.WindowsEditor)
  14. {
  15. p = new ProcessStartInfo();
  16. p.WindowStyle = ProcessWindowStyle.Normal;
  17. p.FileName = Application.dataPath + "/Editor/AndroidLog_WIN.bat";
  18. }
  19. else if (Application.platform == RuntimePlatform.OSXEditor)
  20. {
  21. p = new ProcessStartInfo();
  22. p.UseShellExecute = false;
  23. p.WindowStyle = ProcessWindowStyle.Normal;
  24. p.FileName = "open";
  25. p.Arguments = "-a Terminal.app " + Application.dataPath + "/Editor/AndroidLog_OSX.sh";
  26. }
  27. if(p != null)
  28. {
  29. Process.Start(p);
  30. }
  31. }
  32. [PostProcessBuild]
  33. public static void OnPostProcessBuild (BuildTarget target, string path)
  34. {
  35. LaunchAdbLogcat ();
  36. }
  37. #endif
  38. }