Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.

    Read our full announcement for more information and let us know if you have any questions.

Unity Hub, Smart Merge and Gitconfig portability

Discussion in '2019.2 Beta' started by bitinn, Mar 24, 2019.

  1. bitinn


    Aug 20, 2016
    In the old days, we have one Unity install on the machine, and our gitconfig for UnityYAMLMerge is as simple as following:

    Code (CSharp):
    2. [merge]
    3. tool = unityyamlmerge
    5. [mergetool "unityyamlmerge"]
    6. trustExitCode = false
    7. cmd = '/Applications/Unity/' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
    Assuming all your engineers are on macOS, there won't be any issue.

    Nowadays Unity is installed with Unity Hub, which means the UnityYAMLMerge path kept changing with each release. Such that gitconfig has to keep up, unless given a way to detect Unity install path.

    And of course you run into problems when one user is using Unity Hub and the other is not.

    I don't know the best way to tackle this, but my workaround was to copy UnityYAMLMerge into a custom directory and refers to it. Doing so isn't cross platform neither, and worse, UnityYAMLMerge program doesn't output version information, so it's impossible for me to know when I need to update it next.

    To workaround this, GitHub for Unity has do away with a static gitconfig all together, and make it a dynamic configuration. I doubt everyone has the luxury / incentive of using GitHub tool. So a proper solution is needed for other git users.

    There are a few possible solutions:

    - Unity Hub can distribute this tool separately, so the path is fixed.
    - Unity could update documentation to guide people to setup gitconfig in another way.
    - Unity could integrate this tool with popular code editor as extensions.

    I don't know how other teams solve this issue, so suggestions welcomed.

    (Personally, I seldom run into merge conflict, mostly because I am usually the sole programmer on a project; and in my case I didn't notice the path was wrong in my gitconfig for over 6 months...)
  2. Miika-Virtanen


    Oct 30, 2014
    One possible solution is to create a trampoline application which parses the Unity Hub defaultEditor.json configuration to find the current preferred editor and forwards the call there. You can then keep this tool in a static location and it doesn't need to get updated unless Unity changes where they store the information about current preferred editor.