Skip to content

Instantly share code, notes, and snippets.

@Elideb
Created July 22, 2016 10:50
Show Gist options
  • Save Elideb/c0800e4dc31ec67836404a6d2ca587cc to your computer and use it in GitHub Desktop.
Save Elideb/c0800e4dc31ec67836404a6d2ca587cc to your computer and use it in GitHub Desktop.
Generating builds from scripts in Unity
[MenuItem("Builds/Win 64bits/DRM Free")]
public static void BuildWin64NoDRM() {
string[] levels = new string[] {
"Assets/Test_Levels/LoadingScreen.unity",
"Assets/Test_Levels/Main_Menu.unity",
"Assets/Test_Levels/Credits.unity",
"Assets/Test_Levels/Tutorial.unity",
"Assets/Test_Levels/Test_Level.unity",
"Assets/Test_Levels/Death_Menu.unity"
};
UnityEditor.PlayerSettings.runInBackground = false;
string message = BuildPipeline.BuildPlayer(
levels,
"../Builds/DRMFree/Win64/GameTitle.exe",
BuildTarget.StandaloneWindows64,
BuildOptions.ShowBuiltPlayer);
if (string.IsNullOrEmpty(message))
UnityEngine.Debug.Log("Win64 build complete");
else
UnityEngine.Debug.LogError("Error building Win64:\n" + message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment