using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Interfaces; using UnityEngine; namespace UnityEditor.AddressableAssets.Build { /// /// Data builder context object for Addressables. /// public class AddressablesDataBuilderInput { /// /// The main addressables settings object. /// public AddressableAssetSettings AddressableSettings { get; private set; } /// /// Build target group. /// public BuildTargetGroup TargetGroup { get; private set; } /// /// Build target. /// public BuildTarget Target { get; private set; } /// /// Player build version. /// public string PlayerVersion { get; private set; } /// /// Bool to signify if profiler events should be broadcast. /// public bool ProfilerEventsEnabled { get; private set; } /// /// Registry of files created during the build /// public FileRegistry Registry { get; private set; } //used only by tests to inject custom info into build... internal string PathFormat = string.Empty; /// /// The name of the default Runtime Settings file. /// public string RuntimeSettingsFilename = "settings.json"; /// /// The name of the default Runtime Catalog file. /// public string RuntimeCatalogFilename = "catalog.json"; /// /// The asset content state of a previous build. This allows detection of deltas with the current build content state. This will be /// null in standard builds. This is only set during content update builds. /// public AddressablesContentState PreviousContentState { get; internal set; } /// /// Creates a default context object with values taken from the AddressableAssetSettings parameter. /// /// The settings object to pull values from. public AddressablesDataBuilderInput(AddressableAssetSettings settings) { string version = string.Empty; if (settings == null) { Debug.LogError("Attempting to set up AddressablesDataBuilderInput with null settings."); } else version = settings.PlayerBuildVersion; SetAllValues(settings, BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget), EditorUserBuildSettings.activeBuildTarget, version); } /// /// Creates a default context object with values taken from the AddressableAssetSettings parameter. /// /// The settings object to pull values from. /// The player build version. public AddressablesDataBuilderInput(AddressableAssetSettings settings, string playerBuildVersion) { if (settings == null) { Debug.LogError("Attempting to set up AddressablesDataBuilderInput with null settings."); } SetAllValues(settings, BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget), EditorUserBuildSettings.activeBuildTarget, playerBuildVersion); } internal void SetAllValues(AddressableAssetSettings settings, BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, string playerBuildVersion) { AddressableSettings = settings; TargetGroup = buildTargetGroup; Target = buildTarget; PlayerVersion = playerBuildVersion; ProfilerEventsEnabled = ProjectConfigData.PostProfilerEvents; Registry = new FileRegistry(); PreviousContentState = null; } internal IBuildLogger Logger { get; set; } } }