---
title: "열거형"
content_type: tutorial
url: "https://learn.unity.com/tutorial/yeolgeohyeong?language=ko"
language: ko
difficulty: beginner
duration_minutes: 5
unity_version:
  - "2019.3"
  - "2019.2"
  - "2019.1"
  - "2018.4"
  - "2018.3"
  - "2018.2"
  - "2018.1"
  - "2017.4"
  - "2017.3"
  - "2017.2"
  - "2017.1"
  - "5.x"
  - "4.x"
supported_unity_versions:
  - name: "2019.3"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2019.3"
  - name: "2019.2"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2019.2"
  - name: "2019.1"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2019.1"
  - name: "2018.4"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2018.4"
  - name: "2018.3"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2018.3"
  - name: "2018.2"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2018.2"
  - name: "2018.1"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2018.1"
  - name: "2017.4"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2017.4"
  - name: "2017.3"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2017.3"
  - name: "2017.2"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2017.2"
  - name: "2017.1"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=2017.1"
  - name: "5.x"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=5.x"
  - name: "4.x"
    url: "https://learn.unity.com/tutorial/yeolgeohyeong.md?language=ko&version=4.x"
last_updated: "2026-08-04T14:22:28.000Z"
---

# 열거형

C#에서 열거형을 선언해 관련 상수 값을 하나의 컬렉션으로 묶어 사용하는 방법을 익힙니다.

열거형을 사용하면 관련 상수의 컬렉션을 생성할 수 있습니다. 이 영상에서는 코드에서 열거형을 선언하고 사용하는 방법을 알아봅니다.

이 튜토리얼은 [스크립팅의 기초 프로젝트](https://learn.unity.com/project/beginner-gameplay-scripting)에 포함되어 있습니다.

이전: [Invoke](https://learn.unity.com/tutorial/invoke-2d?projectId=5c8920b4edbc2a113b6bc26a)

다음: [Switch 문](https://learn.unity.com/tutorial/switch-statements?projectId=5c8920b4edbc2a113b6bc26a)

## 열거형

[Video](https://connect-mediagw.unity.com/h1/20220104/videos/c2d4c50d-f50f-496f-b502-99cb05dc87f1_U_Beginner_25_Enumerations.mp4) ([Transcript (ko_kr)](https://connect-mediagw.unity.com/h1/20220427/41c52db0-0686-44ba-987f-9f62c26b00d3_25_Enumerations.ko.vtt))

## **EnumScript**

```csharp
using UnityEngine;
using System.Collections;

public class EnumScript : MonoBehaviour 
{
    enum Direction {North, East, South, West};

        void Start () 
    {
        Direction myDirection;
        
        myDirection = Direction.North;
    }
    
    Direction ReverseDirection (Direction dir)
    {
        if(dir == Direction.North)
            dir = Direction.South;
        else if(dir == Direction.South)
            dir = Direction.North;
        else if(dir == Direction.East)
            dir = Direction.West;
        else if(dir == Direction.West)
            dir = Direction.East;
        
        return dir;     
    }
}
```
