Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- using UnityEditor;
- using UnityEditor.Callbacks;
- /// <summary>
- /// Automatically increment InternalSettingsInstance.versionBuild after an EXE is built.
- /// </summary>
- public class BuildPostprocessor {
- [PostProcessBuildAttribute (1)]
- public static void OnPostprocessBuild (BuildTarget target, string pathToBuiltProject) {
- // to update major or minor version, manually set it in Edit>Project Settings>Player>Other Settings>Version
- // this will also set Application.version which is readonly
- string [] versionParts = PlayerSettings.bundleVersion.Split ('.');
- if (versionParts.Length != 3 /*|| versionParts [2].ParseInt (-1) == -1*/) { //idk what this did, but it broke
- Debug.LogError ("BuildPostprocessor failed to update version " + PlayerSettings.bundleVersion);
- return;
- }
- // major-minor-build
- versionParts [2] = (Int32.Parse( versionParts [2]) + 1).ToString ();
- PlayerSettings.bundleVersion = string.Join (".", versionParts);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement