{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method CleanBundleCache | Addressables | 1.21.17
docs.unity3d.com
"{0}"의 검색 결과

    목차 표시/숨기기

    Method CleanBundleCache

    CleanBundleCache(IEnumerable<string>)

    Removes any AssetBundles that are no longer referenced in the bundle cache. This can occur when a new, updated catalog excludes entries present in an older catalog.

    선언
    public static AsyncOperationHandle<bool> CleanBundleCache(IEnumerable<string> catalogsIds = null)
    파라미터
    타입 이름 설명
    IEnumerable<string> catalogsIds

    The ids of catalogs whose bundle cache entries we want to preserve. If null, entries for all currently loaded catalogs will be preserved.

    반환
    타입 설명
    AsyncOperationHandle<bool>

    The operation handle for the request. Note, that it is user's responsibility to release the returned operation; this can be done before or after the operation completes.

    참고

    This is used to reduce the disk usage of the app by removing AssetBundles that are not needed.

    Note, that only AssetBundles loaded through UnityWebRequest are cached. If you want to purge the entire cache, use Caching.ClearCache instead.

    In the Editor, calling CleanBundleCache when not using the "Use Existing Build (requires built groups)" will clear all bundles. No bundles are used by "Use Asset Database (fastest)" or "Simulate Groups (advanced)" catalogs.

    See AssetBundle caching for more details.

    예

    Using CleanBundleCache to remove unused bundles from cache:

    public void UsingCleanBundleCacheForAllCatalogs()
    {
    	// clear for all currently loaded catalogs
    	// if catalogIds are provided, only those catalogs are used from the currently loaded
    	AsyncOperationHandle<bool> cleanBundleCacheHandle = Addressables.CleanBundleCache();
    	cleanBundleCacheHandle.Completed += op =>
    	{
                  // during caching a reference is added to the catalogs.
                  // release is needed to reduce the reference and allow catalog to be uncached for updating
    		Addressables.Release(op);
    	};
    }

    The catalogIds parameter is used to set which cached bundles are preserved.Any bundles that are used in other catalogs or old bundles from the specified catalogs are removed.If null, all currently loaded catalogs will be preserved. Note, Catalogs other than the main catalog must be loaded to be used for preserving bundles, see[LoadContentCatalogAsync] for more information. Using CleanBundleCache to remove all unused bundles from cache that are not used in the current main catalog:

    public void UsingCleanBundleCacheWithcatalogIds()
    {
    	HashSet<string> catalogsIds = new HashSet<string>();
    	foreach (var locator in Addressables.ResourceLocators)
    	{
    		if (locator.LocatorId == "AddressablesMainContentCatalog")
    		{
    			catalogsIds.Add(locator.LocatorId);
    			break;
    		}
    	}
    
    	if (catalogsIds.Count == 0)
    		return;
    
    	var cleanBundleCacheHandle = Addressables.CleanBundleCache(catalogsIds);
    	cleanBundleCacheHandle.Completed += op =>
    	{
    		// during caching a reference is added to the catalogs.
    		// release is needed to reduce the reference and allow catalog to be uncached for updating
    		Addressables.Release(op);
    	};
    }
    문서 개요
    • CleanBundleCache(IEnumerable<string>)
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)