TSS(테마 스타일시트) 파일은 일반 USS 파일입니다.UI 툴킷은 TSS를 별개의 에셋 타입으로 취급하여 관리 목적으로 사용합니다.
일반적인 USS 구문과 포맷은 TSS 파일에 적용되지만, 일반적으로 테마 파일에는 @import
규칙을 통해 다른 USS 파일에 대한 레퍼런스가 포함되어 있습니다.
참고:USS 파일은 또한 @import
규칙을 지원합니다.
테마별로 서로 다른 TSS 파일을 만들고 런타임 시 서로 전환할 수 있습니다. 일반적으로 스타일에는 USS를 사용해야 합니다. 다양한 플랫폼이나 기기에 맞게 디자인(look and feel)을 커스터마이즈하거나, 게임이나 애플리케이션이 여러 언어를 지원하는 경우 언어별로 다른 폰트를 사용할 때 TSS를 고려합니다.
참고: 프로젝트의 게임 오브젝트에 첫 번째 UIDocument를 추가하면 Assets/UI Toolkit/UnityThemes/UnityDefaultTheme.tss
에 기본 런타임 테마 에셋이 생성됩니다. TSS를 처음부터 생성할 수도 있지만, 모든 기본 UI 컨트롤이 작동하도록 하려면 기본 런타임 테마를 임포트한 다음 새 스타일을 덮어쓰거나 추가하여 커스텀 테마를 만들어야 합니다.
새 TSS를 만들려면:
커스텀 스타일이 있는 USS 파일을 하나 이상 생성합니다.
다음 중 하나를 수행합니다.
스타일 USS 파일을 테마에 임포트합니다.
커스텀 테마는 UI 빌더의 Viewport 테마 목록에도 표시됩니다. 테마를 미리 보려면 Viewport에서 선택합니다.
USS를 사용하는 것과 동일한 방법으로 C# 또는 UXML에서 TSS를 참조할 수 있습니다.
패널 설정 에셋의 기본 테마로 TSS를 설정할 수도 있습니다.패널 설정이 두 개 이상인 경우 각 패널 설정은 서로 다른 TSS 파일을 사용할 수 있습니다.
참고: 패널 설정 에셋에 TSS를 설정해도 TSS가 전체 프로젝트의 글로벌 스타일이 되는 것은 아닙니다. 여전히 UXML 또는 C#에서 TSS를 참조해야 합니다.
TSS 에셋의 인스펙터(Inspector) 창 또는 @import
규칙을 사용하여 테마를 임포트할 수 있습니다.
참고: 현재 TSS와 임포트한 스타일 시트 모두에서 USS 변수 또는 스타일을 정의하는 경우, 현재 TSS는 임포트한 스타일 시트를 오버라이드합니다.
@import
규칙으로 기본 테마 임포트기본 Unity 런타임 테마를 임포트하려면 다음 구문을 사용해야 합니다.
@import url("unity-theme://default");
참고: 이 구문의 URL은 특수한 사례이며 엔진 내 빌트인 기본 테마를 참조합니다. 다른 테마에는 이 구문을 사용할 수 없습니다.
@import
규칙으로 다른 테마 임포트기본 테마가 아닌 테마나 USS 파일을 임포트하려면 다음 구문을 사용합니다.
@import url("<path-to-file>/<file-name-with-extension>");
상대 경로나 절대 경로를 사용할 수 있습니다.
Assets
폴더에서 시작하며 /
또는 project://database/
로 시작합니다. 예를 들면 /Assets/myFolder/myFile.uss
또는 project://database/Assets/myFolder/myFile.uss
입니다./
를 제외합니다. 예를 들면 ../myFolder/myFile.uss
입니다.참고: 패키지에서 파일을 참조하려면 Packages
폴더에서 시작하는 패키지 파일의 절대 경로를 사용합니다. 예를 들어 /Packages/com.unity.package.name/file-name.uss
또는 project://database/Packages/com.unity.package.name/file-name.uss
와 같이 패키지 이름에 package name
이 아닌 com.unity.package.name
형식을 사용해야 합니다.
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.