Skip to content

Instantly share code, notes, and snippets.

@bzgeb
Last active January 25, 2021 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzgeb/016f6653d2fec876f48a0c83e73bc6a6 to your computer and use it in GitHub Desktop.
Save bzgeb/016f6653d2fec876f48a0c83e73bc6a6 to your computer and use it in GitHub Desktop.
Cloud Build Helper - Get Build number for Unity Cloud Build
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