Version: 2022.1
언어: 한국어
스프라이트 에디터: 보조 텍스처
9슬라이싱 스프라이트

정렬 그룹

Sorting Groups allow you to group GameObjects with Sprite Renderers together, and control the order in which they render their Sprites. Unity renders Sprite Renderers in the same Sorting Group together, as if they are a single GameObject.

정렬 그룹 설정

To place a GameObject into a Sorting Group, add the Sorting Group component to it. To do this, select the GameObject and go to Component > Rendering > Sorting Group, or select the Add Component button in the Inspector window of the GameObject.

게임 오브젝트에 Sorting Group 컴포넌트를 추가하면 Unity는 컴포넌트가 연결된 게임 오브젝트의 모든 자식 게임 오브젝트에 동일한 정렬 그룹을 적용합니다.


The ‘Sprite’ child objects belong to the empty parent GameObject’s Sorting Group.

Unity는 정렬 그룹의 설정을 사용하여 씬의 다른 렌더러 및 정렬 그룹 간에 렌더러를 정렬하는 방법을 결정합니다. 자세한 내용은 2D 정렬을 참조하십시오.

정렬 그룹 내에서 렌더러를 정렬하기 위해 Unity는 렌더러의 개별 정렬 설정을 정렬 그룹에 사용합니다. 자세한 내용은 정렬 그룹 내에서 렌더러 정렬을 참조하십시오.

Sorting Group 프로퍼티

Unity uses a Sorting Group’s Sorting Layer and Order in Layer values to determine its priority in the rendering queue among other Sorting Groups and GameObjects in the Scene.

Sorting Group 컴포넌트
Sorting Group 컴포넌트
프로퍼티 기능
Sorting Layer 이 드롭다운 메뉴에서 정렬 레이어를 선택하거나 추가하여 렌더 대기열 내 정렬 그룹의 포지션을 결정합니다. Unity는 정렬 레이어 설정 내 해당 위치를 기준으로 정렬 레이어 순서를 결정하고, 리스트에 표시되는 순서로 정렬 레이어를 렌더링합니다. 정렬 레이어 설정에 대한 자세한 내용은 태그 및 레이어를 참조하십시오.
Order in Layer Set the render order of this Sorting Group within its Sorting Layer. Unity queues Renderers with lower values first in the render queue, so they appear before Renderers with higher values.
Sort At Root Enable this option to ignore all parent Sorting Groups if this Sorting Group is nested. This allows this Sorting Group to be sorted against other Renderers and Sorting Groups at the root level.

정렬 레이어를 사용하여 스프라이트 정렬과 Unity의 렌더러 정렬 기준에 대한 자세한 내용은 2D 정렬을 참조하십시오.

정렬 그룹 내 렌더러 정렬

Unity sorts all Renderers within the same Sorting Group by their individual Sorting Layer and Order in Layer Renderer properties. Unity does not consider each Renderer’s individual Distance to Camera property during this sorting process. Instead, it sets a Distance to Camera value for the whole Sorting Group (including all its child Renderers), based on the position of the root GameObject that contains the Sorting Group component.

정렬 그룹의 내부 정렬 순서는 Unity가 다른 렌더러 간의 정렬 그룹과 씬 내 정렬 그룹을 정렬할 때 변하지 않습니다.

다음 다이어그램은 정렬 프로세스를 보여줍니다.

내부 정렬 그룹 정렬 프로세스
내부 정렬 그룹 정렬 프로세스

Unity treats all Renderers that belong to the same Sorting Group as a single layer, and sorts non-grouped Renderers based on their Sorting Layer and Order in Layer property settings.

파티클 시스템

The Editor treats a Particle System that is a child of a Sorting Group as another Renderer within that Sorting Group, and sorts it internally among other Renderers based on its Sorting Layer and Order in Layer property settings.

When Unity sorts the Particle System with the other Renderers within the Sorting Group, it ignores the Particle System’s Sorting Fudge value.

중첩된 정렬 그룹

중첩된 정렬 그룹은 부모 정렬 그룹을 포함한 정렬 그룹입니다. Unity는 해당 부모보다 먼저 중첩된 정렬 그룹 내에서 렌더러를 정렬합니다(정렬 그룹 내 정렬 렌더러 참조).

Unity는 중첩된 정렬 그룹의 내부 정렬 순서를 결정한 후 중첩된 정렬 그룹을 부모 정렬 그룹 내 다른 렌더러 또는 정렬 그룹과 함께 정렬합니다. 중첩된 정렬 그룹은 중첩된 정렬 그룹을 자식으로 가질 수 있습니다. Unity는 최하위 자식 그룹을 먼저 정렬한 후 각 부모 그룹을 정렬합니다.

다음 다이어그램은 중첩된 정렬 그룹의 정렬 프로세스의 예를 보여줍니다.

중첩된 정렬 그룹 정렬 프로세스
중첩된 정렬 그룹 정렬 프로세스

Sort At Root

In certain situations, you may have a nested Sorting Group that is ordered based on the Scene Hierarchy. However, you may want this nested Sorting Group to be rendered separately from its parent Sorting Group without changing its position in the Scene Hierarchy.

You can enable this option to allow this Sorting Group to ignore its parent Sorting Groups, which allows this Sorting Group to be sorted against other Renderers and Sorting Groups globally without requiring the GameObject to be reparented to another Transform. All child Renderers and Sorting Groups (which have not ignored their parents) will be sorted under this Sorting Group.

정렬 그룹 사용

The most common way to create a 2D multi-Sprite character is to arrange and parent multiple Sprite Renderers together in the Hierarchy window to form a character. You can use Sorting Groups to help manage this kind of complex multi-Sprite character.

In the example below, the Sprite Renderers belong to the same Sorting Layer, but with different Order in Layer values. Unity sorts the different parts of a character in the order that you want them to appear.

계층 구조에서 파트가 포함된 캐릭터 프리팹.
계층 구조에서 파트가 포함된 캐릭터 프리팹.

정렬 그룹과 정렬 레이어를 설정한 후 캐릭터를 프리팹으로 저장한 후 원하는 만큼 많이 복제할 수 있습니다.

However, Prefab Sprites all have the same Sorting Layer and Order in Layer values and render to the same layers as other Prefabs, which can cause different parts of a Prefab character to intersect and layer incorrectly.

Unity가 동일한 레이어의 스프라이트를 렌더링하므로 두 프리팹의 스프라이트가 잘못 교차합니다.
Unity가 동일한 레이어의 스프라이트를 렌더링하므로 두 프리팹의 스프라이트가 잘못 교차합니다.

프리팹이 렌더링 순서를 일관되게 유지하여 정확하게 표시되도록 만들려면 각 프리팹의 루트 게임 오브젝트에 Sorting Group 컴포넌트를 추가하십시오. 편집된 프리팹을 저장하면, 프리팹의 모든 현재 및 미래 인스턴스도 Sorting Group 컴포넌트를 가집니다.

Each Prefab should have a Sorting Group component with the same Sorting Layer and Order in Layer property settings. This might cause Renderers in the Prefabs that are on the same Sorting Layer to render in inconsistent ways, because they have the same priority in the Render Queue.

To prevent this issue, give each Prefab’s Sorting Group component a unique Order in Layer value. Unity renders Sorting Groups with lower Order in Layer values first and those with higher values overlap the Sorting Groups that are lower. Refer to Tags and Layers for more information about editing and reordering Sorting Layers.

Each Prefab has a Sorting Group component with a unique Order in Layer value to ensure that Unity renders each character and their parts correctly.

스프라이트 에디터: 보조 텍스처
9슬라이싱 스프라이트
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961