반응형
1.19.18 버전 공식문서
https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/index.html
DownloadDependenciesAsync
다운받을게 얼마나 있는지 확인
설명
https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/DownloadDependenciesAsync.html
명세
Sample Code
public IEnumerator Start()
{
string key = "assetKey";
//Clear all cached AssetBundles
// WARNING: This will cause all asset bundles to be re-downloaded at startup every time and should not be used in a production game
// Addressables.ClearDependencyCacheAsync(key);
//Check the download size
AsyncOperationHandle<long> getDownloadSize = Addressables.GetDownloadSizeAsync(key);
yield return getDownloadSize;
//If the download size is greater than 0, download all the dependencies.
if (getDownloadSize.Result > 0)
{
AsyncOperationHandle downloadDependencies = Addressables.DownloadDependenciesAsync(key);
yield return downloadDependencies;
}
//...
}
Addressables.GetDownloadSizeAsync(assetLabel.labelString).Completed +=
(AsyncOperationHandle<long> SizeHandle) =>
{
OnGetServerBundleSize(SizeHandle.Result);
Addressables.Release(SizeHandle);
};
위의 것이 Document코드고 아래것은 기존에 사용했던 코드.
Modification events
Addressable의 변화여부를 리턴해줌.
https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/ModificationEvents.html
Sample Code
AddressableAssetSettings.OnModificationGlobal += (settings, modificationEvent, data) =>
{
if(modificationEvent == AddressableAssetSettings.ModificationEvent.EntryAdded)
{
//Do work
}
};
AddressableAssetSettingsDefaultObject.Settings.OnModification += (settings, modificationEvent, data) =>
{
if (modificationEvent == AddressableAssetSettings.ModificationEvent.EntryAdded)
{
//Do work
}
};
반응형
'Unity > Unity 리서치' 카테고리의 다른 글
[Addressable] Build Mode Script (0) | 2022.02.27 |
---|---|
[Addressable] Update 과정 (0) | 2022.02.26 |
Google Store에 150MB이상의 aab파일 업로드 (1) | 2022.02.16 |
Unity Build결과물 용량 확인 (0) | 2022.02.14 |
[Addressable] Catalog (0) | 2022.02.14 |