Unity/Unity 리서치
Addressable 동기(Synchronized)로 구현
lipnus
2022. 2. 4. 01:01
반응형
Resource로드하는 것처럼 동기로 구현할 수 있는 방법.
WaitforCompletion() 매소드.
이 API는 어드레서블 패키지 1.17.4 버전부터 제공되며, Unity 2021.1, Unity 2020 LTS, Unity 2019 LTS와 호환
Example
void Start()
{
//Basic use case of forcing a synchronous load of a GameObject
var op = Addressables.LoadAssetAsync<GameObject>("myGameObjectKey");
GameObject go = op.WaitForCompletion();
//Do work...
Addressables.Release(op);
}
// 바로 Instantiate할때도 사용가능
prefab = Addressables.InstantiateAsync(path, parent).WaitForCompletion();
Synchronous Workflow | Addressables | 1.17.17
Synchronous Workflow Synchronous Addressables APIs help to more closely mirror Unity asset loading workflows. AsyncOperationHandles now have a method called WaitForCompletion() that force the async operation to complete and return the Result of the operati
docs.unity3d.com
최근에 나온 API라
검색해서 나오는 블로그 설명글들은 대부분 비동기로 구현되어있어서 몰랐었는데.. 찾아보니 있다.
반응형