---
title: Unity 레이어 사용
product: Unity Editor
version: '6000.0'
latest_version: '7000.0'
status: This page documents version 6000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/ko-kr/engine/6000.0/manual/working-with-gameobjects/layers/use
latest_url: https://docs.unity.com/ko-kr/engine/7000.0/manual/working-with-gameobjects/layers/use.md
last_updated: 2026-10-30
generated_at: 2026-11-20T01:18:06.955Z
locale: ko-kr
---

# Unity 레이어 사용

> Unity 일반적인 레이어 애플리케이션을 이해합니다.

레이어를 사용하여 프로젝트와 워크플로를 최적화할 수 있습니다. 레이어의 일반적인 용도에는 다음이 포함됩니다.

* 레이어 기반 렌더링
* 레이어 기반 충돌

## 레이어와 함께 카메라 컬링 마스크 사용##use-the-camera-culling-mask-with-layers

카메라의 컬링 마스크를 사용하는 경우 특정 레이어의 오브젝트만 렌더링하거나 레이어를 선택할 수 있습니다. 컬링 마스크를 변경하려면 사용할 카메라를 선택하고 인스펙터 창에서 Editor 드롭다운을 선택합니다. 레이어의 체크박스를 지우면 씬에서 렌더링되지 않습니다.

> **Note:**
>
> UI 요소와 스크린 공간 캔버스 자식은 예외이며 그에 상관없이 렌더링됩니다.

## 레이어가 있는 레이캐스트##ray-cast-with-layers

레이어를 사용하여 레이캐스트가 교차할 수 있는 GameObjects 오브젝트를 지정할 수 있습니다. 레이캐스트가 게임 오브젝트를 무시하도록 하려면 레이캐스트 무시 레이어에 할당하거나 레이캐스트 API 호출에 [레이어마스크](/engine/6000.0/manual/working-with-gameobjects/layers/and-layermasks.md)를 전달할 수 있습니다.

레이캐스트 API 호출에 LayerMask를 전달하지 않으면 Unity는 레이캐스트 무시를 제외한 모든 레이어와 매칭되는 [Physics.DefaultRaycastLayers](/engine/6000.0/script-reference/unityengine/physics/defaultraycastlayers.md)를 사용합니다.

Physics.레이캐스트 함수는 비트마스크를 사용하며, 각 비트는 레이어가 무시되는지 여부를 결정합니다. 레이어마스크의 모든 비트가 켜져 있으면 레이가 모든 콜라이더와 충돌합니다. layerMask가 = 0이면 충돌이 발생하지 않습니다.

예를 들어 레이어 8에 레이캐스팅하려는 경우 아래 코드 샘플을 참조하십시오.

```lang-cs
int layerMask = 1 << 8;

// Does the ray intersect any objects which are in layer 8?
if (Physics.Raycast(transform.position, Vector3.forward, Mathf.Infinity, layerMask))
{
    Debug.Log("The ray hit the player");
}
```

그런 다음 반대로 조작하면 레이가 레이어 8을 제외한 모든 레이어와 충돌합니다.

```lang-cs
void Update ()
{
    // Bit shift the index of the layer (8) to get a bit mask
    int layerMask = 1 << 8;

    // This casts rays only against colliders in layer 8.
    // But to collide against everything except layer 8, use the ~ operator because it inverts a bitmask.
    layerMask = ~layerMask;

    RaycastHit hit;
    // Does the ray intersect any objects excluding layer 8.
    if (Physics.Raycast(transform.position, transform.TransformDirection (Vector3.forward), out hit, Mathf.Infinity, layerMask))
    {
        Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) * hit.distance, Color.yellow);
        Debug.Log("Did Hit");
    }
    else
    {
        Debug.DrawRay(transform.position, transform.TransformDirection (Vector3.forward) *1000, Color.white);
        Debug.Log("Did not Hit");
    }
}
```

> **Note:**
>
> 레이캐스트 함수에 레이어마스크를 전달하지 않으면 IgnoreRaycast 레이어를 사용하는 콜라이더도 무시됩니다.

## 추가 리소스##additional-resources

* [태그 및 레이어](/engine/6000.0/manual/unity-editor/editor-settings-reference/comp-manager-group/class-tag-manager.md)
* [Unity Learn: Unity Essentials](https://learn.unity.com/pathway/5f7bcab4edbc2a0023e9c38f)
* [레이어 기반 충돌 검사](/engine/6000.0/manual/physics-section/physics-overview/collision-section/collision-detection/layer-based-collision.md)
