USS 변수는 모든 스타일 값 타입을 포함할 수 있는 커스텀 사용자 정의 이름이 있는 일반 USS 스타일 프로퍼티입니다. USS 변수는 다른 USS 스타일 프로퍼티에서 값 대신 사용될 수 있습니다. USS 변수는 주로 테마에 사용되며, Unity 기본 테마는 UI가 표준 컨트롤과 보다 일치하도록 수많은 표준 변수를 표시합니다. 아래의 예제는 USS의 변수 정의와 사용을 나타냅니다.
* {
--my-var: 20px;
}
.my-button {
width: var(--my-var);
}
UI 빌더에서 StyleSheet USS 스타일 프로퍼티에 변수를 할당하려면 다음 단계를 따르십시오.
이 옵션은 스타일 필드를 일시적으로 텍스트 필드로 전환하여 USS 변수의 이름을 입력할 수 있게 합니다.
변수의 이름을 입력하기 시작하면 드롭다운 메뉴가 다음에서 나온 일치하는 변수를 표시합니다.
또한 변수 드롭다운에서 변수 옵션을 선택하고 해당 변수의 현재 값과 변수가 유래한 StyleSheet 에셋을 확인할 수 있습니다. Enter 키를 누르면 변수가 설정되며, 스타일 필드가 원래 타입으로 돌아갑니다.
이미 텍스트 필드인 스타일 필드의 경우, 숫자 대신 --
를 입력하기 시작하여 변수를 할당할 수도 있습니다.
필드 레이블이 상자 안에 있는지 살펴보아 이미 변수가 할당된 스타일 필드를 확인할 수 있습니다.
변수 할당을 제거하려면 Set Variable을 선택하고 변수 이름을 삭제하십시오.
UI 빌더에서 USS 변수를 사용할 때 추가로 다음에 유의하십시오.
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.