UnityYAMLMerge라는 툴을 사용하여 씬과 프리팹 파일을 구문상 올바르게 병합할 수 있습니다. 툴은 커맨드 라인에서 접근이 가능하며 타사 버전 관리 소프트웨어에서도 사용할 수 있습니다.
버전 컨트롤 프로젝트 설정(메뉴: Edit > Project Settings > Version Control)에서, Mode 필드에서 타사 버전 컨트롤 툴(예: Perforce, PlasticSCM)을 선택하면 Smart Merge가 표시됩니다. 이 메뉴의 옵션은 다음과 같습니다.
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에 이미 기본적으로 나열되어 있지만 파일을 편집하여 새 툴을 추가하거나 옵션을 변경할 수 있습니다.
UnityYAMLMerge는 스탠드얼론 툴로써 커맨드 라인에서 실행할 수 있습니다(인수 없이 실행하면 전체 사용법을 볼 수 있습니다). 일반 버전 관리 시스템용 셋업 방법은 아래와 같습니다.
.unity
를 입력합니다.merge -p %b %1 %2 %r
을 입력합니다.그런 다음 같은 절차에 따라 .prefab
확장자를 추가합니다.
.git
또는 .gitconfig
파일에 다음 텍스트를 추가해야 합니다.
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = '<path to UnityYAMLMerge>' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
.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
~/.subversion/config
파일에 다음을 추가해야 합니다.
[helpers]
merge-tool-cmd = <path to UnityYAMLMerge>
.unity
를 입력합니다. <path to UnityYAMLMerge> merge -p %base %theirs %mine %merged
그런 다음 같은 절차에 따라 .prefab
확장자를 추가합니다.
.unity
확장자를 추가합니다. <path to UnityYAMLMerge> merge -p "@basefile" "@sourcefile" "@destinationfile" "@output"
그런 다음 같은 절차에 따라 .prefab
확장자를 추가합니다.
merge -p $BASE $REMOTE $LOCAL $MERGED
을 입력합니다.UnityYAMLMerge가 파일을 병합하는 방식을 커스터마이즈하려면 mergerules.txt 파일을 설정하십시오. 이 파일은 Unity 설치의 Editor/Data/Tools
폴더에 있습니다.
다음과 같은 다양한 설정 옵션을 이용할 수 있습니다.
배열 설정 섹션은 지정된 경로를 배열(키 값이 있는 “set” 배열 또는 키 값이 없는 “plain” 배열)로 처리하도록 UnityYAMLMerge에 지시합니다. 모든 배열의 기본값은 하이브리드 모드를 수행하고 일부 알려진 휴리스틱스에 맞추는 것입니다.
[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
제외 설정 섹션에는 병합에서 제외할 경로가 나와 있습니다. 양쪽을 모두 수정한 경우에는 충돌로 간주되고 사용자 입력을 위해 표시됩니다.
[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
비교 섹션은 사용자 설정별로 무시할 부동 소수점 값 간의 경미한 차이를 고려합니다. 활성화하면 상대적인 부동 소수점 비교를 수행하여 상대 오차를 처리합니다. 비교는 다음과 같은 방법으로 설정할 수 있습니다.
상대 비교값은 엡실론, 그리고 플로트의 상대 오차 크기에 따라 비교가 스케일링되는 방식을 결정합니다. 절대 비교 컷오프는 플로트 비교가 그래프의 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
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.