본문 바로가기
유니티

TIL . Unity Addressables

by 유니티세상 2026. 3. 11.
반응형

나는 유니티 빌드 용량을 줄이기 위해 어드레서블에 대해 학습했다.

1. Addressables란 무엇인가

Addressables는 Unity 에셋을 관리하고 로드하기 위한 시스템이다.

Unity 프로젝트에서는 다양한 리소스를 사용한다.

 

예:

  • Prefab
  • Texture
  • Sprite
  • AudioClip
  • Scene
  • Material
  • Animation

이러한 리소스들을 필요할 때 로드하고 필요 없을 때 메모리에서 해제할 수 있도록 관리하는 시스템이 Addressables이다.

즉 Addressables의 핵심 목적은 다음과 같다.

  • 에셋 관리
  • 메모리 관리
  • 로딩 관리

이를 흔히 Dynamic Asset Management (동적 에셋 관리) 라고 부른다.


용어정리

 

Catalog
→ 리소스 목록

Bundle
→ 에셋 묶음 파일

Cache
→ Cache는 다운로드된 번들을 저장하거나 이미 로드된 번들을 재사용하기 위한 저장 영역이다.

Address
→ 에셋 ID

Address는 코드에서 에셋을 찾기 위한 이름

 

예시)

Goblin.prefab
Address : Goblin

 


Group
→ 번들 생성 단위

 

Monsters Group
 ├ Goblin.prefab
 ├ Orc.prefab
 └ Troll.prefab

위에껄 빌드하면

monsters.bundle이 생성된다 


Label
→ 에셋 태그

 

Goblin.prefab
Label : Monster

 

Address → 하나 로드
Label → 여러 개 로드


2. Addressables의 기본 구조

Addressables는 크게 세 가지 요소로 구성된다.

Catalog
Bundle
Cache

Bundle

Bundle은 에셋을 묶은 파일이다.

Addressables 빌드를 하면 Unity 에셋들이 AssetBundle 형태로 패키징된다.

 

예:

goblin.bundle
dungeon.bundle
ui.bundle
cutscene.bundle

 

예를 들어 goblin.bundle 안에는 다음이 들어갈 수 있다.

Goblin.prefab
Goblin.mesh
Goblin.texture
Goblin.animation
Goblin.audio

즉 하나의 콘텐츠에 필요한 리소스를 묶어서 관리한다.


Catalog

Catalog는 리소스 목록 파일이다.

 

예:

catalog.json

Catalog에는 다음 정보가 저장된다.

  • Address 이름
  • 어떤 Bundle에 있는지
  • 번들의 hash
  • 번들의 위치

게임이 실행되면 먼저 Catalog를 확인하고 필요한 번들을 찾는다.


Cache

다운로드된 번들은 디바이스 캐시에 저장된다.

즉 구조는 다음과 같다.

서버
↓
다운로드
↓
Cache 저장
↓
메모리 로드

3. Addressables의 동작 흐름

게임 실행 시 전체 흐름은 다음과 같다.

게임 실행
↓
Catalog 확인
↓
필요한 Bundle 확인
↓
Bundle 다운로드
↓
Cache 저장
↓
메모리 로드
↓
게임에서 사용

 

예:

플레이어가 던전에 입장하면

dungeon.bundle 다운로드
↓
메모리 로드
↓
플레이

4. 에셋 타입마다 로딩 코드가 다른 이유

처음에는 왜 에셋마다 로딩 방식이 다른지 헷갈렸다.

 

예를 들어:

  • GameObject
  • Texture
  • AudioClip
  • Scene

각각 로딩 방식이 조금씩 다르다.

이유는 런타임에서 사용하는 방식이 다르기 때문이다.

 

예:

Prefab은 Instantiate가 필요하다.

var handle = Addressables.LoadAssetAsync<GameObject>("Goblin");
await handle.Task;

GameObject goblin = Instantiate(handle.Result);

Texture는 보통 UI나 Material에 연결한다.

var handle = Addressables.LoadAssetAsync<Texture2D>("GoblinTexture");

AudioClip은 AudioSource에서 재생한다.

var handle = Addressables.LoadAssetAsync<AudioClip>("BGM");
audioSource.clip = handle.Result;
audioSource.Play();

Scene은 전용 API로 로드한다.

Addressables.LoadSceneAsync("DungeonScene");

에셋 타입마다 사용 방식이 다르기 때문에 로딩 코드도 다르다.


5. Addressables 메모리 관리

Addressables는 Reference Count 기반 메모리 관리를 사용한다.

 

에셋을 로드하면

Reference Count = 1

Release 하면

Reference Count -1

0이 되면 메모리에서 제거된다.

예:

Addressables.Release(handle);

즉 구조는 다음과 같다.  

Load
↓
사용
↓
Release

 

씬 전환 시 GameObject는 삭제되지만 Addressables로 로드된 Asset은 Reference Count가 남아있으면

메모리에서 유지될 수 있으므로 Release를 통해 명시적으로 해제하는 것이 좋다.

 

 


6. Address / Group / Label

Addressables에서 중요한 개념 3가지가 있다.

Address

코드에서 에셋을 찾는 이름이다.

 

예:

Goblin
DungeonScene
BattleBgm

코드

Addressables.LoadAssetAsync("Goblin");

Group

Group은 AssetBundle을 생성하는 단위이며, 실제 다운로드되는 단위는 Bundle이다. .

 

예:

Characters
Monsters
Maps
UI
Cutscenes

Label

Label은 에셋 태그이다.

논리적으로 묶을 때 사용한다.

 

예:

Monster
Character
UI
Weapon

7. Group 설계 기준

처음에는 에셋 종류별로 나누는 것이 좋다고 생각했지만

 

예:

잘못된 구조

Textures
Meshes
Materials
Prefabs

이렇게 나누면 한 Prefab을 로드할 때 여러 Bundle을 동시에 다운로드해야 한다.

이를 Bundle Dependency Hell이라고 한다고 한다.

 

그래서 보통 콘텐츠 단위로 나눈다.

 

예:

Characters
Monsters
Maps
UI
Cutscenes
Events
Shared

에셋 종류가 아니라 플레이 흐름 기준으로 묶는다.


8. Resources와 Addressables 차이

Resources

장점

  • 사용이 매우 간단

단점

  • Resources 폴더의 모든 리소스가 빌드에 포함됨
  • 메모리 관리가 어렵다
  • 프로젝트가 커지면 관리가 어려움

Addressables

장점

  • 필요할 때 로드
  • Release 기반 메모리 관리
  • 콘텐츠 단위 관리 가능
  • 구조가 체계적

단점

  • 초기 설정이 필요
  • 학습 비용이 있다

9. 서버가 없는 경우

Addressables는 서버 없이 로컬에서도 사용 가능하다.

이 경우 구조는 다음과 같다.

빌드
↓
AssetBundle 포함
↓
로컬에서 로드
↓
필요한 것만 메모리에 올림
↓
Release로 메모리 해제

 

즉 서버 다운로드 기능은 없지만

  • 메모리 관리
  • 그룹 관리
  • 로딩 구조 관리

장점은 그대로 사용할 수 있다.


10. WebGL에서 Addressables

WebGL에서는 특히 초기 로딩 시간이 중요하다.

예를 들어 콘텐츠가 12개 있다고 하면
처음부터 전부 로드하면 초기 로딩 시간이 매우 길어진다.

그래서 보통 다음 구조를 사용한다.

Bootstrap
↓
Lobby
↓
콘텐츠 선택
↓
Addressables 씬 로드

예:

Content_01.scene
Content_02.scene
Content_03.scene
...
Content_12.scene

필요한 콘텐츠만 로드한다.


11. 로컬 Addressables와 빌드 용량

로컬 Addressables는 빌드 용량 자체를 줄이기 위한 기술은 아니다.

서버를 사용하지 않는다면

Resources ≈ Local Addressables

용량은 거의 비슷하다.

하지만 Addressables는

  • 로딩 구조 관리
  • 메모리 관리
  • 콘텐츠 분리

장점이 있다.


12. 총정리

Unity 에셋을 Bundle 단위로 관리하고
필요할 때 로드하며
Reference Count 기반으로 메모리를 관리하는 시스템이다.

 

Unity 프로젝트에서 리소스를 효율적으로 관리하기 위한 시스템이다.

 

참고사항)
어드레서블 참고
https://velog.io/@ttangu5510/Unity-Addressable

튜토리얼
https://learn.unity.com/course/get-started-with-addressables/tutorial/host-your-built-content-locally-during-development?version=2022.2

어드레서블 로컬
https://www.youtube.com/watch?v=Z84GCeod_BM

어드레서블 서버
https://www.youtube.com/watch?v=uTSxPPaW2-k

아래 학습을 전부 마치면 수월하다고 함
https://learn.unity.com/pathway/creative-core

 

Unity Learn

Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.

learn.unity.com

 

 

 

 

Unity Learn

Free tutorials, courses, and guided pathways for mastering real-time 3D development skills to make video games, VR, AR, and more.

learn.unity.com

 

 

Unity - Addressable

에셋을 외부저장소에서 불러와 적용할 수 있게 해본다.

velog.io

 

 

 

 

 

 

 

반응형

'유니티' 카테고리의 다른 글

Addressables 세팅 방법 및 샘플 코드  (0) 2026.03.12
Unity Garbage Collection  (0) 2026.03.11
unity webgl 탭이름 및 아이콘 수정하는 방법  (0) 2026.02.25
휴머노이드 애니메이션  (0) 2026.02.05
unity MVVM  (0) 2026.02.05