12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using UnityEngine;
- using UnityEditor;
- using UnityEditor.Callbacks;
- using System.Collections;
- using System.Diagnostics;
- public static class PostBuildTrigger
- {
- #if UNITY_ANDROID
- [MenuItem("AV/Launch ADB Logcat", false, 0x897)]
- public static void LaunchAdbLogcat ()
- {
- ProcessStartInfo p = null;
-
- if (Application.platform == RuntimePlatform.WindowsEditor)
- {
- p = new ProcessStartInfo();
- p.WindowStyle = ProcessWindowStyle.Normal;
- p.FileName = Application.dataPath + "/Editor/AndroidLog_WIN.bat";
- }
- else if (Application.platform == RuntimePlatform.OSXEditor)
- {
- p = new ProcessStartInfo();
- p.UseShellExecute = false;
- p.WindowStyle = ProcessWindowStyle.Normal;
- p.FileName = "open";
- p.Arguments = "-a Terminal.app " + Application.dataPath + "/Editor/AndroidLog_OSX.sh";
- }
-
- if(p != null)
- {
- Process.Start(p);
- }
-
- }
-
- [PostProcessBuild]
- public static void OnPostProcessBuild (BuildTarget target, string path)
- {
- LaunchAdbLogcat ();
- }
- #endif
- }
|