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

Question Include branch name and changeset number in game version?

Discussion in 'Unity Version Control' started by ccfoo242, Jun 13, 2022.

  1. ccfoo242

    ccfoo242

    Joined:
    Oct 9, 2014
    Posts:
    85
    Is it possible to grab the current branch name and changeset number and store it somewhere that the game can access?

    upload_2022-6-13_9-55-59.png

    I'd like to include version number, branch name, and changeset number in an 'about' popup for when QA reports a bug, I can go back to the exact version that used when tracking down the problem.

    Is this possible? My first guess is i could run a script on build (is that possible?) that accesses Plastic api and writes the info I need to a text for json file in the Resources folder. Then the game can do a Resources.Load<TextAsset>("plasticinfo") to get the info.
     
  2. Sravzz

    Sravzz

    Unity Technologies

    Joined:
    May 13, 2020
    Posts:
    29
    Hello,
    Thank you for your question.
    You can use the "cm find changeset", "cm find branch" to get the information you are looking for. Please find the documentation on this here.
     
  3. danipen-unity

    danipen-unity

    Unity Technologies

    Joined:
    Mar 23, 2021
    Posts:
    1
    @ccfoo242 you can get the working branch/changeset/label with the following command:

    PS C:\wks\code> cm status --cset
    cs:215708@rep:codice@repserver:codice@cloud


    An alternative way to do this is using the cm find command:


    PS C:\wks\code> cm wi
    Branch /main/scm32579@codice@codice@cloud


    And then you can query the last changeset in that branch:

    PS C:\wks\code> cm find changeset "where branch='/main/scm32579'" --nototal | select -Last 1
    29099650 215708 /main/scm32579 06/13/22 04:49:31 PM dpenalba@codicesoftware.com codice Undo unneeded changes
     
  4. ccfoo242

    ccfoo242

    Joined:
    Oct 9, 2014
    Posts:
    85

    Awesome, thanks! Do you know if its possible to run these commands in a Unity Cloud Build? And do the methods like OnPreprocessBuild() allow for execution of exe's or cmd files? Or is there a C# api that I can use that does these commands?