Last active
January 25, 2021 16:47
-
-
Save bzgeb/016f6653d2fec876f48a0c83e73bc6a6 to your computer and use it in GitHub Desktop.
Cloud Build Helper - Get Build number for Unity Cloud Build
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 UnityEngine; | |
using UnityEditor; | |
using System; | |
public class CloudBuildHelper : MonoBehaviour | |
{ | |
#if UNITY_CLOUD_BUILD | |
public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest) | |
{ | |
/* | |
string buildNumber = manifest.GetValue("buildNumber", "0"); | |
Debug.LogWarning("Setting build number to " + buildNumber); | |
PlayerSettings.Android.bundleVersionCode = int.Parse(buildNumber); | |
PlayerSettings.iOS.buildNumber = buildNumber; | |
*/ | |
string path = "Assets/Resources/VersionNumber.txt"; | |
StreamWriter writer = new StreamWriter(path, false); | |
writer.WriteLine(GetVersionNumberString()); | |
writer.Close(); | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment