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

    목차 표시/숨기기

    Property WebRequestOverride

    WebRequestOverride

    Delegate that can be used to override the web request options before being sent.

    선언
    public Action<UnityWebRequest> WebRequestOverride { get; set; }
    프로퍼티 값
    타입 설명
    Action<UnityWebRequest>
    참고

    You can assign a function to the Addressables object's WebRequestOverride property to individually modify the UnityWebRequest which is used to download files.

    This can be used to add custom request headers or query strings.

    This affects all downloads through Addressables including catalog files and asset bundles.

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

    For example you could add an Authorization header to authenticate with Cloud Content Delivery's private buckets.

    using UnityEngine.Networking;
    using UnityEngine.AddressableAssets;
    using System.Text;
    
    internal class PrivateWebRequestOverride : MonoBehaviour
    {
        [SerializeField]
        private String bucketAccessToken;
    
        //Register to override WebRequests Addressables creates to download
        private void Start()
        {
            Addressables.WebRequestOverride = AddPrivateToken;
        }
    
        // Demonstrate adding an Authorization header to access a Cloud Content Delivery private bucket
        private void AddPrivateToken(UnityWebRequest request)
        {
            var encodedToken = Convert.ToBase64String(Encoding.UTF8.GetBytes($":{bucketAccessToken}"));
            request.SetRequestHeader("Authorization", $"Bearer: {encodedToken}");
        }
    }
    참고
    Transforming resource URLs
    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)