Created
November 10, 2020 00:21
-
-
Save colinsenner/79899d1613079ca2af66a5f5b74e2177 to your computer and use it in GitHub Desktop.
Unity Cloud Build AutoIncrement
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
// https://bigcheeseapp.com/2019/04/25/automatically-set-ios-build-number-and-android-version-code-in-unity-cloud-build/ | |
public class AutoIncrementVersion | |
{ | |
#if UNITY_CLOUD_BUILD | |
public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest) | |
{ | |
string buildNum = "unknown"; | |
Debug.LogFormat($"PreExport:: PlayerSettings.WebGL.template = '{PlayerSettings.WebGL.template}'"); | |
manifest.TryGetValue<string>("buildNumber", out buildNum); | |
Debug.LogFormat($"AutoIncrementVersion.PreExport() called, build number is {buildNum}"); | |
string versionString = $"{Application.version}.{buildNum}"; | |
Debug.LogFormat($"PlayerSettings.bundleVersion set to {versionString}"); | |
PlayerSettings.bundleVersion = versionString; | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment