Version: 2020.3
Unity에서 외부 버전 관리 시스템 사용
다중 씬 편집

Smart merge

Use the UnityYAMLMerge tool to merge scene and prefab files in a semantically correct way. The tool can be accessed from the command line and is also available to third-party version control software.

Setting up smart merging in Unity

In the Version Control project settings (menu: Edit > Project Settings > Version Control), when you select a third-party version control tool in the Mode field, for example Perforce or PlasticSCM, the Smart Merge is displayed. The menu has the following options:

  • Off: 스마트 병합 없이 환경 설정에서 설정된 디폴트 병합 툴만을 사용합니다.
  • Premerge: 스마트 병합을 사용하며 클린 병합을 허용합니다. 언클린 병합은 파일의 base, mine, theirs 버전의 사전 병합 버전을 생성합니다. 그 후 디폴트 병합 툴과 함께 사용합니다.
  • Ask: 스마트 병합을 사용하지만 충돌이 발생하면 사용자가 처리할 수 있도록 다이얼로그를 보여 줍니다(이 옵션이 디폴트 설정입니다).

Setting up UnityYAMLMerge for use with third-party tools

UnityYAMLMerge 툴은 Unity 에디터에 내장되어 있습니다. Unity가 표준 위치에 설치되어 있을 경우 UnityYAMLMerge의 경로는 다음과 같습니다.

C:\\Program Files\\Unity\\Editor\\Data\\Tools\\UnityYAMLMerge.exe

또는

C:\\Program Files (x86)\\Unity\\Editor\\Data\\Tools\\UnityYAMLMerge.exe

Windows에서는 위와 같으며

/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge

Mac OSX에서는 위와 같습니다(폴더에 접근하려면 파인더(Finder)에서 패키지 콘텐츠 보기 커맨드를 사용해야 합니다).

UnityYAMLMerge에는 디폴트 폴백(fallback) 파일이 내장되어 있습니다(mergespecfile.txt라는 파일로 마찬가지로 Tools 폴더에 있습니다). 이 파일은 미해결 충돌 또는 알려지지 않은 파일을 어떻게 처리해야 할지 지정합니다. 또한 이를 통해 자동으로 파일 확장자에 따라 버전 관리 시스템(예: git)에 대한 병합 툴을 선택하지 않는 경우에 주 병합 툴로 사용할 수 있습니다. 가장 일반적인 툴은 mergespecfile.txt에 이미 기본적으로 나열되어 있지만 파일을 편집하여 새 툴을 추가하거나 옵션을 변경할 수 있습니다.

You can run UnityYAMLMerge as a standalone tool from the command line (you can see full usage instructions by running it without any arguments). Setup instructions for common version control systems are given below.

P4V

  1. Go to Preferences > Merge.
  2. Select Other application.
  3. Click the Add button.
  4. In the extension field, type .unity.
  5. In the Application field, type the path to the UnityYAMLMerge tool (see above).
  6. In the Arguments field, type merge -p %b %1 %2 %r
  7. Click Save.

그런 다음 같은 절차에 따라 .prefab 확장자를 추가합니다.

Git

.git 또는 .gitconfig 파일에 다음 텍스트를 추가해야 합니다.

    [merge]
        tool = unityyamlmerge

        [mergetool "unityyamlmerge"]
        trustExitCode = false
        cmd = '<path to UnityYAMLMerge>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

Mercurial

.hgrc 파일에 다음 텍스트를 추가해야 합니다.

    [merge-patterns]
        **.unity = unityyamlmerge
        **.prefab = unityyamlmerge

        [merge-tools]
        unityyamlmerge.executable = <path to UnityYAMLMerge>
        unityyamlmerge.args = merge -p --force $base $other $local $output
        unityyamlmerge.checkprompt = True
        unityyamlmerge.premerge = False
        unityyamlmerge.binary = False

SVN

~/.subversion/config 파일에 다음을 추가해야 합니다.

    [helpers]
        merge-tool-cmd = <path to UnityYAMLMerge>

TortoiseGit

  1. Go to Preferences > Diff Viewer > Merge Tool and click the Advanced button.
  2. In the popup, type .unity in the extension field.
  3. In the External Program field type:
    <path to UnityYAMLMerge> merge -p %base %theirs %mine %merged

그런 다음 같은 절차에 따라 .prefab 확장자를 추가합니다.

PlasticSCM

  1. Go to Preferences > Merge Tools and click the Add button.
  2. Select External merge tool.
  3. Select Use with files that match the following pattern.
  4. Add the .unity extension.
  5. Enter the command:
    <path to UnityYAMLMerge> merge -p "@basefile" "@sourcefile"  "@destinationfile" "@output"

그런 다음 같은 절차에 따라 .prefab 확장자를 추가합니다.

SourceTree

  1. Go to Tools > Options > Diff.
  2. Select Custom in the Merge Tool dropdown.
  3. Type the path to UnityYAMLMerge in the Merge Command field.
  4. Type merge -p $BASE $REMOTE $LOCAL $MERGED in the Arguments field.

mergerules.txt 설정

UnityYAMLMerge가 파일을 병합하는 방식을 커스터마이즈하려면 mergerules.txt 파일을 설정하십시오. 이 파일은 Unity 설치의 Editor/Data/Tools 폴더에 있습니다. 다음과 같은 다양한 설정 옵션을 이용할 수 있습니다.

배열

배열 설정 섹션은 지정된 경로를 배열(키 값이 있는 “set” 배열 또는 키 값이 없는 “plain” 배열)로 처리하도록 UnityYAMLMerge에 지시합니다. 모든 배열의 기본값은 하이브리드 모드를 수행하고 일부 알려진 휴리스틱스에 맞추는 것입니다.

  • <모드>는 “set” 또는 “plain” 중 하나입니다.

예제(기본 mergerules 파일을 따름)

[arrays]
set *.GameObject.m_Component *.fileID
set *.Prefab.m_Modification.m_Modifications target.fileID target.guid propertyPath
plain *.MeshRenderer.m_Materials
plain *.Renderer.m_Materials

제외

제외 설정 섹션에는 병합에서 제외할 경로가 나와 있습니다. 양쪽을 모두 수정한 경우에는 충돌로 간주되고 사용자 입력을 위해 표시됩니다.

  • <모드>는 “include”, “exclude”, “includeIfContains”, “excludeIfContains” 중 하나입니다.

예제(기본 mergerules 파일을 따름)

[exclusions]
exclude *.MeshRenderer.m_Materials.*
exclude *.SpriteRenderer.m_Materials
exclude *.SpriteRenderer.m_Color
include *.ParticleSystem.InitialModule
exclude *.ParticleSystem.*
exclude *.ParticleSystem.InitialModule.*
# excludeDepend *.MonoBehaviour m_Script ^m_
excludeIfContains *.MonoBehaviour.* x y z
excludeIfContains *.MonoBehaviour.* r g b

비교

비교 섹션은 사용자 설정별로 무시할 부동 소수점 값 간의 경미한 차이를 고려합니다. 활성화하면 상대적인 부동 소수점 비교를 수행하여 상대 오차를 처리합니다. 비교는 다음과 같은 방법으로 설정할 수 있습니다.

  • “float” <비교할 플로트 값> (엡실론을 머신 엡실론과 가까운 기본값으로 설정함)
  • “float” <비교할 플로트 값> <상대 비교값과 절대 컷오프>
  • “float” <비교할 플로트 값> <상대 비교값> <절대 비교 컷오프>

상대 비교값은 엡실론, 그리고 플로트의 상대 오차 크기에 따라 비교가 스케일링되는 방식을 결정합니다. 절대 비교 컷오프는 플로트 비교가 그래프의 0에서 절대에서 상대로 전환되는 지점을 결정합니다.

참고: 비교값은 플로트 엡실론 (~0.00000011921)과 1.0 사이여야 합니다.

예제

[comparisons]
float *.Transform.m_LocalPosition.x 0.0000005
float *.Transform.m_LocalPosition.y 0.0000005
float *.Transform.m_LocalPosition.z 0.0000005
float *.Transform.m_LocalRotation.x 0.00005 0.001
float *.Transform.m_LocalRotation.y
float *.Transform.m_LocalRotation.z 0.00005 0.001
float *.Transform.m_LocalRotation.w
Unity에서 외부 버전 관리 시스템 사용
다중 씬 편집
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961