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.
Unity's version control component has been upgraded to Plastic SCM.

[Suggestion] API to retrieve current commit number and hash

Discussion in 'Unity Collaborate' started by Zeitcatcher, Apr 14, 2016.

  1. Zeitcatcher

    Zeitcatcher

    Joined:
    Dec 11, 2012
    Posts:
    21
    When using Git, we've had a function that would put current commit number, and it's short hash in the game's version string. Would be great, if at some point you could open an API to retrieve such data from within the project's editor scripts.
     
  2. quixotic

    quixotic

    Unity Technologies

    Joined:
    Nov 7, 2013
    Posts:
    122
    Yay, suggestion! What would you use that for? What kind of problem(s) does it solve? How often do you use it in Git?
     
  3. Zeitcatcher

    Zeitcatcher

    Joined:
    Dec 11, 2012
    Posts:
    21
    What would you use that for?
    It makes up the last two elements of our build versions: major.minor.commit.hash (e.g. 0.1.250.g0c85fbc), where major and minor are manually set, and commit/hash are automatically retrieved from git meta. That way every build based on every single commit is uniquely identifiable from within the game without us having to manually track and increase version number every time we commit anything.

    How often do you use it in Git?
    Since it's automated, it's used every time there is a new build of the game, and it helps immensely in our internal communication as well as when talking with testers. Someone might have missed that there was a hotfix release based on commit #110, and is still reporting bugs based on version number 0.1.109 that was released earlier that day, and things like that.
     
    GarthSmith likes this.
  4. quixotic

    quixotic

    Unity Technologies

    Joined:
    Nov 7, 2013
    Posts:
    122
    Ah, that makes sense, thank you!
     
  5. Nightlord_Glnc

    Nightlord_Glnc

    Joined:
    Aug 13, 2018
    Posts:
    1
    Hi, was this feature ever added?