using System; using System.Collections.Generic; using UnityEditor.AddressableAssets.Build.BuildPipelineTasks; using UnityEditor.AddressableAssets.Settings; using UnityEditor.Build.Pipeline; using UnityEditor.Build.Pipeline.Interfaces; using UnityEngine; namespace UnityEditor.AddressableAssets.Build { /// /// Contains information about the status of the build. /// public class AddressableAssetBuildResult : IDataBuilderResult { /// /// Duration of build, in seconds. /// public double Duration { get; set; } /// /// The number of addressable assets contained in the build. /// public int LocationCount { get; set; } /// /// Error that caused the build to fail. /// public string Error { get; set; } /// /// Path of runtime settings file /// public string OutputPath { get; set; } /// /// Registry of files created during the build /// public FileRegistry FileRegistry { get; set; } /// /// Helper method to create the desired result of a data builder. This should always be used to create the build result /// with additional details added as needed. The Result.Duration should always be set at the end of the build /// script in the non-error scenario. /// /// Path to the settings.json file (name may not always match that exactly) generated by this build /// Number of locations created by this build /// Error string if there were problems with the build. Defaults to empty /// The actual build result created /// public static TResult CreateResult(string settingsPath, int locCount, string err = "") where TResult : IDataBuilderResult { var opResult = Activator.CreateInstance(); opResult.OutputPath = settingsPath; opResult.Duration = 0; opResult.Error = err; opResult.LocationCount = locCount; return opResult; } /// /// Helper method to create the desired result of a data builder. This should always be used to create the build result /// with additional details added as needed. The Result.Duration should always be set at the end of the build /// script in the non-error scenario. Other results should be set as available. /// /// /// public static TResult CreateResult() where TResult : IDataBuilderResult { var opResult = Activator.CreateInstance(); return opResult; } } /// /// Build result for entering play mode in the editor. /// [Serializable] public class AddressablesPlayModeBuildResult : AddressableAssetBuildResult { } /// /// Build result for building the Addressables content. /// public class AddressablesPlayerBuildResult : AddressableAssetBuildResult { internal List m_AssetBundleBuildResults = new List(); /// /// Information about a bundle build results /// [System.Serializable] public class BundleBuildResult { /// /// The file path of the bundle. /// public string FilePath; /// /// The internal AssetBundle name, this is not always the same as the file name. /// public string InternalBundleName; /// /// The Addressable Group that was responsible for generating a given AssetBundle /// public AddressableAssetGroup SourceAssetGroup; /// /// The calculated value used for security during cyclic redundancy checks /// public uint Crc; /// /// The asset hash of the assets included inside the AssetBundle /// public string Hash; } /// /// True if the build was doing an update to a previous build, else false. /// public bool IsUpdateContentBuild { get; internal set; } /// /// Build results for AssetBundles created during the build. /// public List AssetBundleBuildResults => m_AssetBundleBuildResults; /// /// File path to the generated remote catalog hash file. /// public string RemoteCatalogHashFilePath { get; internal set; } /// /// File path to the generated remote catalog json file. /// public string RemoteCatalogJsonFilePath { get; internal set; } /// /// File path to the generate content state file /// public string ContentStateFilePath { get; internal set; } } }