Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How can I get "Bundle Version" and "Bundle Version Code" through script?

Discussion in 'Android' started by Tai, Nov 24, 2010.

  1. Flexford

    Flexford

    Joined:
    Dec 8, 2016
    Posts:
    20
    It's not flexible solution, because:
     
  2. Riiich

    Riiich

    Joined:
    Sep 30, 2014
    Posts:
    18
    It's stupid but this is how Meta does it when creating new code versions:


    Code (CSharp):
    1.     public void OnPostprocessBuild(BuildReport report)
    2.     {
    3. #if UNITY_ANDROID
    4.         if (autoIncrementVersion)
    5.         {
    6.             if ((report.summary.options & BuildOptions.Development) == 0)
    7.             {
    8.                 PlayerSettings.Android.bundleVersionCode++;
    9.                 UnityEngine.Debug.Log("Incrementing version code to " + PlayerSettings.Android.bundleVersionCode);
    10.             }
    11.         }
    12.        // ...
    13. }