您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
31 行
952 B
31 行
952 B
using UnityEditor;
|
|
using UnityEditor.AddressableAssets.Settings;
|
|
|
|
public static 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)
|
|
{
|
|
Popup();
|
|
|
|
BuildPlayerWindow.DefaultBuildMethods.BuildPlayer(options);
|
|
}
|
|
|
|
public static void Popup()
|
|
{
|
|
if (EditorUtility.DisplayDialog(Title, Message, Agree, Disagree))
|
|
{
|
|
AddressableAssetSettings.BuildPlayerContent();
|
|
}
|
|
}
|
|
}
|