using System; using System.Collections.Generic; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline.Interfaces; using UnityEngine; using UnityEngine.AddressableAssets.Initialization; using UnityEngine.AddressableAssets.ResourceLocators; namespace UnityEditor.AddressableAssets.Build.DataBuilders { /// /// Interface for any Addressables specific context objects to be used in the Scriptable Build Pipeline context store /// public interface IAddressableAssetsBuildContext : IContextObject { } /// /// Simple context object for passing data through SBP, between different sections of Addressables code. /// public class AddressableAssetsBuildContext : IAddressableAssetsBuildContext { private AddressableAssetSettings m_Settings; /// /// The settings object to use. /// public AddressableAssetSettings Settings { get { if (m_Settings == null && !string.IsNullOrEmpty(m_SettingsAssetPath)) m_Settings = AssetDatabase.LoadAssetAtPath(m_SettingsAssetPath); return m_Settings; } set { m_Settings = value; string guid; if (m_Settings != null && AssetDatabase.TryGetGUIDAndLocalFileIdentifier(m_Settings, out guid, out long localId)) m_SettingsAssetPath = AssetDatabase.GUIDToAssetPath(guid); else m_SettingsAssetPath = null; } } private string m_SettingsAssetPath; /// /// The time the build started /// public DateTime buildStartTime; /// /// The current runtime data being built. /// public ResourceManagerRuntimeData runtimeData; /// /// The list of catalog locations. /// public List locations; /// /// Mapping of bundles to asset groups. /// public Dictionary bundleToAssetGroup; /// /// Mapping of asset group to bundles. /// public Dictionary> assetGroupToBundles; /// /// Set of provider types needed in this build. /// public HashSet providerTypes; /// /// The list of all AddressableAssetEntry objects. /// public List assetEntries; /// /// Mapping of AssetBundle to the direct dependencies. /// public Dictionary> bundleToImmediateBundleDependencies; /// /// A mapping of AssetBundle to the full dependency tree, flattened into a single list. /// public Dictionary> bundleToExpandedBundleDependencies; /// /// A mapping of Asset GUID's to resulting ContentCatalogDataEntry entries. /// public Dictionary> GuidToCatalogLocation = null; } }