{!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} Property InternalIdTransformFunc | Addressables | 1.21.17
docs.unity3d.com
"{0}"의 검색 결과

    목차 표시/숨기기

    Property InternalIdTransformFunc

    InternalIdTransformFunc

    Functor to transform internal ids before being used by the providers.

    선언
    public Func<IResourceLocation, string> InternalIdTransformFunc { get; set; }
    프로퍼티 값
    타입 설명
    Func<IResourceLocation, string>

    A function taking an IResourceLocation and returning a transformed string location.

    참고

    Used to assign a function to the ResourceManager that replaces location identifiers used at runtime. This is useful when you want to load assets from a different location than the one specified in the content catalog, for example downloading a remote AssetBundle from a different URL.

    Assigning this value through the Addressables object will set the value on the ResourceManager.

    The example below instantiates a GameObject from a local AssetBundle. The location identifier of the bundle is replaced with a file URI, and so the bundle is loaded via UnityWebRequest.

    public AssetReferenceGameObject asset; // Identify the asset
    AsyncOperationHandle<GameObject> opHandle;
    
    void UsingInternalIdTransformFuncSample()
    {
        Addressables.InternalIdTransformFunc = MyCustomTransform;
        opHandle = Addressables.InstantiateAsync(asset);
        opHandle.Completed += OnInstantiateComplete;
    }
    
    //Implement a method to transform the internal ids of locations
    static string MyCustomTransform(IResourceLocation location)
    {
        if (location.ResourceType == typeof(IAssetBundleResource)
            && !location.InternalId.StartsWith("http"))
        {
            Debug.Log($"Replace local identifier with remote URL : {location.InternalId}");
            return "file:///" + location.InternalId;
        }
    
        return location.InternalId;
    }
    
    void OnInstantiateComplete(AsyncOperationHandle<GameObject> handle)
    {
        if (handle.Status == AsyncOperationStatus.Succeeded)
        {
            Debug.Log($"Successfully instantiated GameObject named '{handle.Result.name}'");
        }
    }
    
    void ReleaseResources()
    {
        Addressables.Release(opHandle);
    }
    
    // When ready to release the asset, call ReleaseResources().
    // For example during OnDestroy().
    //void OnDestroy()
    //{
    //    ReleaseResources();
    //}
    ///
    참고
    Transforming resource URLs
    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)