Skip to content

Commit

Permalink
Change buildscript to only write version if it should be set
Browse files Browse the repository at this point in the history
When versioning: None is set the version values should not be overwritten with "none", but kept as is, since that matches the documentation
  • Loading branch information
JohannesDeml authored Jul 4, 2024
1 parent c631604 commit 46723e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions example/BuildScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public static void Build()
Dictionary<string, string> options = GetValidatedOptions();

// Set version for this build
PlayerSettings.bundleVersion = options["buildVersion"];
PlayerSettings.macOS.buildNumber = options["buildVersion"];
PlayerSettings.Android.bundleVersionCode = int.Parse(options["androidVersionCode"]);
if(options.TryGetValue("buildVersion", out string buildVersion) && buildVersion != "none")
{
PlayerSettings.bundleVersion = buildVersion;
PlayerSettings.macOS.buildNumber = buildVersion;
}
if(options.TryGetValue("androidVersionCode", out string versionCode) && versionCode != "0")
{
PlayerSettings.Android.bundleVersionCode = int.Parse(options["androidVersionCode"]);
}

// Apply build target
var buildTarget = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]);
Expand Down

0 comments on commit 46723e6

Please sign in to comment.