-
-
Save ArthurD/954a7b4dbc1eece53ec75e6024d1b8aa to your computer and use it in GitHub Desktop.
Build Code Example
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
private static void RunBuildsExample() { | |
// Build Each Target 1X / Branch | |
while(BuildTargets.Count > 0) { | |
var target = BuildTargets[0]; | |
BuildTargets.RemoveAt(0); | |
foreach(var branch in Branches(optionsMask)) { | |
MakeOneBuild(buildDate, optionsMask, branch, target); | |
} | |
} | |
} | |
private static void MakeOneBuild(DateTime buildDate, int optionsMask, Branch branch, BuildTarget target) { | |
// Build Date, Scripting Defines | |
PlayerSettings.bundleVersion = BuildDate.ToString(buildDate); | |
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, ScriptingDefines(optionsMask, branch)); | |
// If !DryRun -- DO IT! | |
if (!BuildMakerWindow.isProperty(BuildMakerWindow.BProp.DRY_RUN, optionsMask)) { | |
// Set Build Target | |
if(EditorUserBuildSettings.activeBuildTarget != target) | |
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, target); | |
// Handle Addressables, which are actually Asset Bundles. | |
AddressableAssetSettings.CleanPlayerContent(); | |
AddressableAssetSettings.BuildPlayerContent(); | |
// Build it | |
BuildPipeline.BuildPlayer(Scenes, FullPathForSingleBuild(buildDate, branch, target), target, GetBuildOptions(optionsMask)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment