using System;
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;
}
}
///
/// Build result for entering play mode in the editor.
///
[Serializable]
public class AddressablesPlayModeBuildResult : AddressableAssetBuildResult
{
}
///
/// Build result for building the player.
///
public class AddressablesPlayerBuildResult : AddressableAssetBuildResult
{
}
}