Last active
July 22, 2016 11:33
-
-
Save Elideb/2b317d718efb6fc97b38626b7c89caa2 to your computer and use it in GitHub Desktop.
Generating builds from scripts in Unity
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
[MenuItem("Builds/Win 64bits/DRM Free Worldwide")] | |
public static void BuildWin64NoDRMWorldwide() { | |
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" | |
}; | |
// Overwrite LanguageLoader | |
System.IO.File.Copy("Langs/LanguageLoader_NoDRM_WorldWide.prefab", "Resources/Langs/LanguageLoader.prefab", true); | |
// Reimport the prefab, because otherwise Unity will use the "Library" imported version. | |
AssetDatabase.Refresh(); | |
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