Created
April 6, 2014 09:04
-
-
Save brovador/10003380 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using System; | |
using System.Diagnostics; | |
public class PostBuildTrigger : MonoBehaviour { | |
[PostProcessBuild(300)] | |
public static void OnPostProcessBuild(BuildTarget target, string path) | |
{ | |
if (target == BuildTarget.iPhone) { | |
UnityEngine.Debug.Log("Python postprocess script"); | |
string unityPath = Application.dataPath; | |
Process pythonProcess = new Process(); | |
pythonProcess.StartInfo.FileName = "pyhton"; | |
pythonProcess.StartInfo.Arguments = string.Format("/Assets/path/to/python/script.py \"{0}\" \"{1}\"", path, objCPath); | |
pythonProcess.StartInfo.UseShellExecute = false; | |
pythonProcess.StartInfo.RedirectStandardOutput = false; | |
UnityEngine.Debug.Log(pythonProcess.StartInfo.Arguments); | |
pythonProcess.Start (); | |
pythonProcess.WaitForExit(); | |
UnityEngine.Debug.Log("Python script executed"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment