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

    목차 표시/숨기기

    Property PlayerBuildDataPath

    PlayerBuildDataPath

    The path that addressables player data gets copied to during a player build.

    선언
    public static string PlayerBuildDataPath { get; }
    프로퍼티 값
    타입 설명
    string
    참고

    This resolves to Assets/StreamingAssets/aa by default. Files in this folder are included in the player build process. Remote bundles should be built outside this folder to prevent them from being included in the default player build.

    예

    This example is a custom build script that extends the default packed build script. Files are built in a custom build folder, and then copied into PlayerBuildDataPath so they are included with the player build.

    using System.IO;
    using UnityEditor;
    using UnityEditor.AddressableAssets.Build;
    using UnityEditor.AddressableAssets.Build.DataBuilders;
    using UnityEditor.AddressableAssets.Settings;
    using UnityEngine;
    using UnityEngine.AddressableAssets;
    
    
    [CreateAssetMenu(fileName = "CustomLocationBuildScript.asset", menuName = "Addressables/Custom Build/Custom Location Build Script")]
    public class CustomLocationBuildScript : BuildScriptPackedMode
    {
    
        // BuildPath is set to [CustomLocationBuildScript.CustomLocationBuildRoot]/SpecialGroup/[BuildTarget]
        // LoadPath is set to {UnityEngine.AddressableAssets.Addressables.PlayerBuildDataPath}/SpecialGroup/[BuildTarget]
        public static string CustomLocationBuildRoot
        {
            get { return "CustomBuildPath"; }
        }
    
        public override string Name
        {
            get { return "Custom Location Build Script"; }
        }
    
        protected override TResult BuildDataImplementation<TResult>(AddressablesDataBuilderInput context)
        {
            var result = base.BuildDataImplementation<TResult>(context);
    
            AddressableAssetSettings settings = context.AddressableSettings;
            CopyBundles(settings);
            return result;
        }
    
        void CopyBundles(AddressableAssetSettings settings)
        {
    
            // if the PlayerBuildDataPath does not exist, create it
            var streamingAssetsPath = Addressables.PlayerBuildDataPath;
            if (!Directory.Exists(streamingAssetsPath))
            {
                Directory.CreateDirectory(streamingAssetsPath);
            }
    
            // Copy all directories from the CustomLocationBuildRoot to the PlayerBuildDataPath
            var directories = Directory.GetDirectories(CustomLocationBuildRoot);
            foreach (var directory in directories)
            {
                var fileName = Path.GetFileName(directory);
                FileUtil.ReplaceFile($"{CustomLocationBuildRoot}/{fileName}", $"{streamingAssetsPath}/{fileName}");
            }
        }
    }
    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)