Skip to content

Instantly share code, notes, and snippets.

@brovador
Created April 6, 2014 09:04
Show Gist options
  • Save brovador/10003380 to your computer and use it in GitHub Desktop.
Save brovador/10003380 to your computer and use it in GitHub Desktop.
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