优化实践教程示例项目
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

26 行
923 B

using UnityEditor;
using UnityEditor.AddressableAssets.Settings;
public class AutoBuildAddressables
{
private const string Title = "Adressables";
private const string Message = "This project uses Addressables for it's content, if you havent built these already the player will fail to function correctly.";
private const string Agree = "Build Adressables Now";
private const string Disagree = "Ignore";
[InitializeOnLoadMethod]
private static void Initialize()
{
BuildPlayerWindow.RegisterBuildPlayerHandler(BuildPlayerHandler);
}
private static void BuildPlayerHandler(BuildPlayerOptions options)
{
if (EditorUtility.DisplayDialog(Title, Message, Agree, Disagree))
{
AddressableAssetSettings.BuildPlayerContent();
}
BuildPlayerWindow.DefaultBuildMethods.BuildPlayer(options);
}
}