Skip to content

Commit

Permalink
Fix check for if the version is actually set
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDeml committed Jul 4, 2024
1 parent 1b518da commit 43d4ca3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Assets/Scripts/Editor/BuildScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ public static void Build(string[] args)
// Gather values from args
Dictionary<string, string> options = GetValidatedOptions(args);

// Set version for this build
PlayerSettings.bundleVersion = options["buildVersion"];
PlayerSettings.macOS.buildNumber = options["buildVersion"];
PlayerSettings.Android.bundleVersionCode = int.Parse(options["androidVersionCode"]);
// Set version for this build if provided
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 43d4ca3

Please sign in to comment.