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

    목차 표시/숨기기

    Property BuildPath

    BuildPath

    The build path used by the Addressables system for its initialization data.

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

    Addressables.BuildPath returns the path used by the Addressables system for its built initialization data. This path is to the Addressables folder in the Project Library folder for the active platform.This folder contains the settings, local catalog and addressables managed local asset bundles.

    예

    Gets the runtime settings from the buildPath and returns the Addressables package version that the content was built using.

    public string GetBuiltContentAddressablesVersion()
    {
    	string settingsPath = Addressables.BuildPath + "/settings.json";
    	if (System.IO.File.Exists(settingsPath))
    	{
    		string json = System.IO.File.ReadAllText(settingsPath);
    		ResourceManagerRuntimeData activeRuntimeSettings =
    			JsonUtility.FromJson<ResourceManagerRuntimeData>(json);
    		return activeRuntimeSettings.AddressablesVersion;
    	}
    	return null;
    }

    In this example we add a build pre-process hook. When building a player this throws an exception if the content has not been built. This could be useful when 'Build Addressables on Player Build' is not set in Addressables Settings.

    #if UNITY_EDITOR
    using System.Collections;
    using System.Collections.Generic;
    using System.IO;
    using UnityEditor.AddressableAssets;
    using UnityEditor.AddressableAssets.Build;
    using UnityEditor.AddressableAssets.Settings.GroupSchemas;
    using UnityEditor.Build;
    using UnityEditor.Build.Reporting;
    using UnityEngine;
    using UnityEngine.AddressableAssets;
    
    public class ContentBuiltCheck : IPreprocessBuildWithReport
    {
        public int callbackOrder => 1;
    
        public void OnPreprocessBuild(BuildReport report)
        {
            // we don't want to throw the exception in our continuous integration environment
            if (Application.isBatchMode)
            {
                return;
            }
            var settingsPath = Addressables.BuildPath + "/settings.json";
            if (!File.Exists(settingsPath))
            {
                throw new System.Exception("Player content has not been built. Aborting build until content is built. This can be done from the Addressables window in the Build->Build Player Content menu command.");
            }
        }
    }
    #endif
    문서 개요
    맨 위로
    Copyright © 2023 Unity Technologies — 상표 및 이용약관
    • 법률정보
    • 개인정보처리방침
    • 쿠키
    • 내 개인정보 판매 금지
    • Your Privacy Choices (Cookie Settings)