Unity

리소스 관리 - Addressable (4) - Scene

Dean83 2024. 2. 2. 11:47

이전 페이지 : https://dean83.tistory.com/206

 

리소스 관리 - Addressable (3) - Sprite

이전 페이지 : https://dean83.tistory.com/205 리소스 관리 - Addressable (2) 이전 페이지 : https://dean83.tistory.com/204 이번에는 inspector 에서 직접연결을 통해 addressable 리소스를 이용하는 법을 정리한다. 방식은

dean83.tistory.com

 

Scene 또한 Addressable로 관리가 가능하다. 

 

주의점 ! : Scene 을 Addressable 로 묶었을 경우, 빌드세팅 → Scenes in Build 에 체크가 해제 되어 있을텐데, 이를 체크하면 Addressable 이 풀려 버려 동작하지 않으므로, 체크 해제한 상태로 둬야 한다

 

using UnityEngine.ResourceManagement.ResourceProviders;  

[SerializeField]
private AsyncOperationHandle<SceneInstance> m_scene;

....

m_scene = Addressables.LoadSceneAsync("addressable 등록된 씬명칭",activateOnLoad : true);

....

 

만일, 씬 로딩에 대한 진행도를 알고 싶다면, 

....

while (m_scene.IsDone == false)
{
    Debug.Log(m_scene.PercentComplete);

}

...