Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Where can I set the version number?

Discussion in 'Unity Cloud Diagnostics' started by Hyp-X, Aug 1, 2016.

  1. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    75
    At the performance report I see the "Affected Version" is 1.0
    Where can I set this version number?
    (Unity 5.4 target platform: Windows / x64)
     
  2. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    882
    Hi Hyp-X,

    The Affected Version number is grabbed from the Player Settings in Unity. To set that version, go to Edit-->Project Settings-->Player, then hit the tab with the icon of a phone to switch over to iOS settings. Underneath Identification you will see Version tucked between Bundle Identifier and Build.

    Screen Shot 2016-08-01 at 10.48.41 AM.png

    Setting Version will change the version of your app the next time you build or run your project. I hope this answers your question and let us know if you have any other comments or concerns.
     
  3. Hyp-X

    Hyp-X

    Joined:
    Jun 24, 2015
    Posts:
    75
    Thanks.

    I didn't want to download and install iOS support, just to set a variable, but I found I can set this manually in ProjectSettings.asset as "bundleVersion" or from script as PlayerSettings.bundleVersion

    This code should help most people (BuildInfo.buildNumber needs to be substituted for something that you have in your build system)

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditor.Callbacks;
    3.  
    4. public static class VersionHelper
    5. {
    6.     [PostProcessScene(10)]
    7.     static void SetBuildVersion()
    8.     {
    9.         if (EditorApplication.isPlayingOrWillChangePlaymode)
    10.             PlayerSettings.bundleVersion = "Editor (" + System.Environment.MachineName +")";
    11.         else
    12.             PlayerSettings.bundleVersion = "Build " + BuildInfo.buildNumber + " (" + System.Environment.MachineName + ")";
    13.     }
    14. }
    15.  
     
    ryanc-unity likes this.
  4. blueteak

    blueteak

    Joined:
    Feb 19, 2013
    Posts:
    122
    Made a little editor window that lets you set the version number using the same PlayerSettings.bundleVersion

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public class VersionHelper : EditorWindow
    5. {
    6.     string versionNum;
    7.     string lastVersion;
    8.     bool changed;
    9.     [MenuItem("Window/Version Helper")]
    10.     public static void ShowWindow()
    11.     {
    12.         EditorWindow.GetWindow(typeof(VersionHelper));
    13.     }
    14.  
    15.     void OnGUI()
    16.     {
    17.         if (!changed)
    18.         {
    19.             versionNum = PlayerSettings.bundleVersion;
    20.             lastVersion = versionNum;
    21.         }
    22.         EditorGUIUtility.labelWidth = 80;
    23.         versionNum = EditorGUILayout.TextField("Version", versionNum);
    24.         if(lastVersion != versionNum)
    25.         {
    26.             changed = true;
    27.         }
    28.         if (changed)
    29.         {
    30.             if (GUILayout.Button("Set Version"))
    31.             {
    32.                 PlayerSettings.bundleVersion = versionNum;
    33.                 changed = false;
    34.             }
    35.         }
    36.     }
    37. }
    38.  
     
    khaled24 and scboydj167 like this.
  5. Tuni

    Tuni

    Joined:
    May 24, 2013
    Posts:
    74
    Maybe you should change (or let the team in charge of the player settings know) that the version number should be accessible from other platforms too? Telling a standalone only dev to download and install support for a mobile platform to change the version number of your game sounds wrong.
     
  6. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    49
    This is still an issue, and I concur 100%! Or at least document how to change it via code, which is what we wanted to be able to do anyways!
     
  7. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    882
    Hi @Tuni and @ADanto6840! You're right that this is still an issue and needs to be better. We're hoping to add a universal version that can be used by the entire Editor without requiring any specific platform in the future.
     
  8. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    174
    Does Unity have a recommended practice for how to better control version reporting in Game Performance Tools now that we no longer call CrashReporting.Init() in Unity 5.5? Here's a specific example where this is problematic:

    1. Our team starts working on version 1.5.0 of our game.
    2. We set the Application.version value to 1.5.0 in the Build Settings.
    3. We begin development, distributing multiple test builds to our network of testers over the course of a few weeks.

    Previously we had been using an internal buildNumber property that we append to the Application.version value when initializing CrashReporting. We appended a suffix like this "1.5.0b1", "1.5.0b2", "1.5.0b3", "1.5.0b4" so that we could get versioned error reports to appear in Game Performance Reporting that we could filter on. Since iOS doesn't allow you to upload builds with a format like this, how do you recommend we move forward to get clear error reporting per version during testing? We don't want to change our versioning format, but currently we have no way to get errors broken down per test build. We preferred the old way where the developer was in control of the version passed into the system.
     
  9. ryanc-unity

    ryanc-unity

    Unity Technologies

    Joined:
    Mar 23, 2016
    Posts:
    882
    Hi @TitanUnity! I tried using a similar naming format ("1.5b1") for one of my test projects and was able to build just fine to my iPad mini running on iOS 10.2.1. The crash reports from this build can be filtered by that version, as well. I'm not sure what format restrictions you're seeing on your end. Can you point to anywhere online that mentions this or screenshots of errors that you're seeing in Xcode when you try this format?

    If for some reason you can't using letters in your version format, perhaps you could try underscores? I tried that as well with iOS and didn't have issues there either. Maybe give something like "1.5.0_1" a try. I hope that helps to answer your question.
     
    metanautvr likes this.
  10. Xblade-Imperium42

    Xblade-Imperium42

    Joined:
    Jan 12, 2016
    Posts:
    533
    That would rock!! It's way more complicated than I thought it would be lol
     
  11. pesahov

    pesahov

    Joined:
    May 24, 2017
    Posts:
    12
    Any updates on this feature?
     
  12. Infrid

    Infrid

    Joined:
    Jan 14, 2012
    Posts:
    67
    +1 for me - I'm currently doing a custom script with auto version date - it's less than desirable.
     
  13. Xblade-Imperium42

    Xblade-Imperium42

    Joined:
    Jan 12, 2016
    Posts:
    533
    How is this not a feature, yet D:
     
    kaarloew likes this.
  14. Melon24

    Melon24

    Joined:
    May 14, 2018
    Posts:
    1
    do u know how to throw user to play store for update when new version release
     
  15. Mgravitus

    Mgravitus

    Joined:
    Oct 8, 2015
    Posts:
    11
    @Ryanc_unity any update on this feature, again having to change settings in a different platform not ideal when auto retrieving version number.
     
  16. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    157
    I think you wanted @ryanc-unity
     
  17. joshenes

    joshenes

    Joined:
    Apr 18, 2014
    Posts:
    46
    You don't need a script or to add any iOS support.
    - Edit > Project Settings > Player.
    - Under "Other Settings" there is a "Mac App Store Options" section.
    - Change the field labeled "Version*".