Last active
August 29, 2015 14:22
-
-
Save Podshot/359200206f9262cc3ccd to your computer and use it in GitHub Desktop.
A Builder script I created to build all OS releases together without a lot of clicking
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 System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using Stopwatch = System.Diagnostics.Stopwatch; | |
public class Builder { | |
private static string[] levels = new string[] {"Assets/<Scene File.unity>"}; | |
private static string buildPath = Application.dataPath.Replace("Assets", "/")+"Builds/"; | |
// This is project specific | |
// Change each key to the path/directory structure you prefer | |
private static Dictionary<string, BuildTarget> buildTypes = new Dictionary<string, BuildTarget>() { | |
{"Windows/<Windows 64bit Release.exe>", BuildTarget.StandaloneWindows64}, | |
{"Windows/<Windows 32bit Release.exe>", BuildTarget.StandaloneWindows}, | |
{"Mac/<OS X Universal Release.app>", BuildTarget.StandaloneOSXUniversal}, | |
{"Linux/<Linux Universal Release.x86>", BuildTarget.StandaloneLinuxUniversal} | |
}; | |
[MenuItem("Tools/Build Project", false, 1)] | |
private static void BuildProject() { | |
Stopwatch timer = new Stopwatch(); | |
timer.Start(); | |
foreach (KeyValuePair<string, BuildTarget> entry in buildTypes) { | |
if (File.Exists(buildPath + entry.Key)) { | |
File.Delete(buildPath + entry.Key); | |
} | |
Debug.Log("Building " + entry.Key); | |
BuildPipeline.BuildPlayer(levels,buildPath + entry.Key, entry.Value, BuildOptions.None); | |
} | |
timer.Stop(); | |
Debug.Log("Building took: "+(timer.ElapsedMilliseconds/1000)+"s"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment