Unity에서 프리팹이 작동하는 방식과 유사하게 기존 UXML 문서를 템플릿으로 인스턴스화하여 템플릿 인스턴스로 사용할 수 있습니다.
프로젝트에서 기존 UXML 문서를 템플릿으로 사용하려면 다음 단계를 따르십시오.
.uxml
)을 찾습니다.템플릿 인스턴스는 TemplateContainer
유형의 일반 요소처럼 Hierarchy에 나타납니다..uxml` 파일 이름은 이름 오른쪽에 회색 글꼴로 표시됩니다.템플릿 인스턴스를 확장하면 인스턴스의 내부 계층 구조를 확인할 수 있습니다.이 내부 계층 구조는 요소를 사용한 작업에 설명된 대로 읽기 전용이며 참조용으로만 사용할 수 있습니다.
UXML 문서 내의 하위 문서를 템플릿 인스턴스로 만들어 재사용할 수 있습니다.
이렇게 하면 기존 문서에서 하위 문서가 템플릿 인스턴스로 인스턴스화됩니다.
템플릿 인스턴스로 사용되는 원본 UXML 문서를 편집하려면 템플릿 인스턴스를 오른쪽 클릭하고 다음 옵션 중 하나를 선택합니다.
Open in UI Builder:현재 UXML 문서를 언로드하고 Template Instance를 로드합니다.
Open Instance in Isolation:Template Instance를 로드하는 동안 배경에서 현재 UXML 문서가 로드된 상태를 유지합니다.Hierarchy 및 Canvas에는 해당 템플릿 인스턴스의 콘텐츠만 표시되며, StyleSheets 창에는 읽기 전용 상태로 배경 부모 UXML 문서의 스타일시트가 포함됩니다.이것은 다음과 같이 스타일시트가 여전히 템플릿 인스턴스에 적용되고 있기 때문입니다.
Open Instance in Context:모든 요소를 읽기 전용으로 설정하고 Hierarchy 및 Canvas에서 흐리게 표시하면서 현재 UXML 문서를 로드한 상태로 유지합니다.템플릿 인스턴스의 콘텐츠는 부모 UXML 문서의 컨텍스트 내에서 편집할 수 있습니다.이 옵션을 사용하면 호스트 문서의 컨텍스트를 잃지 않고 템플릿 인스턴스 콘텐츠를 업데이트할 수 있습니다.
Show in Project:프로젝트(Project) 창에 Template Instance 파일의 위치를 표시합니다.
두 번째 및 세 번째 옵션의 경우 Viewport 위에 이동 경로가 표시됩니다.이 이동 경로를 사용하여 부모 UXML 문서로 돌아갈 수 있습니다.
하나의 템플릿 인스턴스의 압축을 풀려면 템플릿 인스턴스를 오른쪽 클릭하고 Unpack Instance를 선택합니다.이렇게 하면 템플릿 인스턴스가 일반 UXML 문서로 변경됩니다.
모든 템플릿 인스턴스의 압축을 풀려면 템플릿 인스턴스를 오른쪽 클릭하고 Unpack Instance Completely를 선택합니다.이렇게 하면 모든 템플릿 인스턴스가 일반 UXML 문서로 변경됩니다.
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.