Version: 2023.1
언어: 한국어
Create USS variables
USS built-in variable references

Introduction to USS built-in variables

USS built-in variables specify default values for Editor and runtime UI. You can use these variables in your own USS to match your custom interfaces with Unity style.

The name of each built-in variable indicates how and where the variable is used. A variable name consists of one or more parts, separated by hyphens. Each part consists of one or more words separated by underscores.

--unity-{group}-{role_and_control}-{sub_element}-{pseudo_state_sequence}

Each part of the name shows the types of USS rules that use the variable.

  • Group: The kind of data the variable represents.
  • Role/Control: A conceptual grouping for the elements the variable affects.
  • Sub-Element: An element or control the variable affects.
  • Pseudo States: Lists the states Unity uses the variable for.

다음의 변수 이름을 예로 들 수 있습니다.

--unity-colors-button-text-hover

이 변수 이름은 Unity가 변수를 사용하는 방법에 대한 다음의 정보를 제공합니다.

의미
그룹 colors Represents color data.
역할/컨트롤 button Affects buttons.
하위 요소 text Affects text. Its group is colors, so it affects text color.
유사 상태 hover Applies to elements when the mouse pointer hovers over them.

This USS built-in variable changes the color of button text when a user hovers over the button.

Group

The group specifies what kind of data the variable represents. Each group has several possible sub-elements.

The variable names have the following groups:

그룹 용도
colors background-color, border-color 등과 같은 컬러 프로퍼티
metrics 크기와 모양을 제어하는 프로퍼티. 예: border-radius, border-width, margin, padding
icons 일반 Unity 아이콘 이미지

Role and Control

역할과 컨트롤은 요소를 개념적으로 그룹화하는 두 가지 방법입니다.

  • Role refers to a group of elements that have the same purpose, regardless of what type each element is. For example, the error role includes all elements that display error messages to users.
  • Control refers to a group of elements of the same type, regardless of what they do. For example, buttons includes all buttons in the Editor.

Each variable has either a role or a control.

The variable names have the following roles and controls:

Roles

Role 설명
default 텍스트 컬러, 배경, 여백 등과 같은 기본 스타일 설정.
alternated_rows 번갈아 나오는 행 컬러의 표 데이터를 표시하는 요소. 예: 리스트 뷰의 리스트 항목.
error 사용자에게 오류 상태를 전달하는 요소.
highlight 강조 표시된 UI 부분. 예: 텍스트 선택 항목, 또는 트리 뷰의 선택된 항목.
link 클릭 가능한 링크인 UI(일반적으로 텍스트)의 일부. 클릭되지 않은 상태입니다.
play_mode 에디터가 플레이 모드일 때 표시되는 요소.
visited_link 클릭 가능한 링크인 UI(일반적으로 텍스트)의 일부. 사용자가 이미 클릭한 상태입니다.
warning 사용자에게 경고 메시지를 전달하는 요소.

컨트롤

컨트롤 설명
app_toolbar 메인 Unity 툴바
app_toolbar_button 메인 Unity 툴바의 버튼
box 에디터 UI에서 요소를 그룹화하는 데 사용되는 상자
button UI의 버튼(툴바 제외)
dropdown 드롭다운 리스트 또는 메뉴
helpbox 도움말 정보를 표시하는 데 사용되는 상자
input_field 텍스트 또는 숫자 값을 입력하는 데 사용되는 필드
label 에디터 UI의 텍스트 레이블
object_field 오브젝트 값에 사용되는 필드. 예: 게임 오브젝트 또는 에셋의 프로퍼티 값.
popup 팝업 메뉴 및 기타 팝업 컨트롤
preview 미리보기를 표시하는 데 사용되는 뷰. 예: 메시, 텍스처 등과 같은 에셋.
scrollbar_groove 사용자가 스크롤바 썸을 드래그하는 스크롤바의 배경 요소
scrollbar_thumb 스크롤바의 드래그 가능한 핸들 요소
slider_groove 사용자가 슬라이더 썸을 드래그하는 슬라이더의 배경 요소
slider_thumb 슬라이더의 드래그 가능한 핸들 요소
slider_thumb_halo 사용자가 드래그할 때 슬라이더 썸 주위에 표시되는 오버레이
tab 탭 컨트롤의 탭 항목
toolbar 메인 Unity 툴바(app_toolbar)를 제외한 모든 에디터 툴바
toolbar_button 에디터 툴바의 버튼
window 에디터 창

Sub-Element

The sub-element is the part of an element that the variable affects. Together with a variable’s group, the sub-element shows what kind of data the variable represents.

예를 들어 colors 그룹과 text 하위 요소가 있는 이름이 표시되면 Unity가 텍스트 컬러에 영향을 미치는 스타일에 변수를 사용한다는 의미입니다.

The variable names have the following sub-elements:

그룹 Sub-element 설명
colors
background 요소의 배경 컬러
border 요소의 바깥쪽 테두리 컬러
border_accent 요소의 안쪽 테두리 컬러. 예: 인스펙터 창에 있는 투톤 테두리
text 텍스트를 표시하는 요소의 텍스트 컬러
metrics
margin_{left, top, right, bottom} 요소의 여백 값
padding_{left, top, right, bottom} 요소의 패딩 값
border_{left, top, right, bottom}_width 요소의 테두리 너비 값
border_{left_top, left_bottom, right_top, right_bottom}_radius 요소의 테두리 반지름 값
width, height 요소의 너비 및 높이 값

Pseudo-States

유사 상태 시퀀스는 Unity가 변수를 사용하는 UI 상태의 리스트입니다.

예를 들어 ’hover 유사 상태의 변수 이름이 표시되면 Unity가 사용자가 요소 위에 포인터를 올려 놓을 때 요소에 영향을 미치는 스타일에 변수를 사용한다는 의미입니다.

예: --unity-colors-toolbar_button-text-hover.

변수 이름은 두 개 이상의 유사 상태를 가질 수 있습니다. 여러 개의 유사 상태는 밑줄(_)로 구분된 알파벳순으로 표시됩니다.

예: --unity-colors-toolbar_button-text-focus_selected.

Unity 변수 이름은 다음의 유사 상태 조합을 가질 수 있습니다.

Pseudo-state 설명
(없음) 일반 상태
checked 체크박스 타입의 컨트롤이 선택됨
disabled 컨트롤이 비활성화됨
focus 컨트롤에 포커스가 있음
hover 사용자가 컨트롤에 마우스 포인터를 올려 놓음
inactive A control doesn’t have focus
pressed 컨트롤을 누름
selected 컨트롤을 선택함

추가 리소스

Create USS variables
USS built-in variable references
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961