【m】build apk 开发

This commit is contained in:
2025-07-02 17:58:55 +08:00
parent 9e46410516
commit 15289e30c5
3 changed files with 21 additions and 2 deletions

View File

@@ -83,18 +83,32 @@ public class BuildApkWindow : OdinEditorWindow
if (hotfixMainResDomain == null)
{
Debug.LogError("HotfixMainResDomain 资源在Resources下不存在请检查");
return;
}
if (hotfixMainResDomain.projectInfo.loadingScene == null)
{
Debug.LogError("HotfixMainResDomain 资源中loadingScene索引不存在请检查");
return;
}
// 设置包名和项目名
PlayerSettings.productName = hotfixMainResDomain.projectInfo.projectName;
PlayerSettings.applicationIdentifier = hotfixMainResDomain.projectInfo.projectPackageName;
// 获取loadingScene的Assets相对路径
string loadingScenePath = AssetDatabase.GetAssetPath(hotfixMainResDomain.projectInfo.loadingScene);
if (string.IsNullOrEmpty(loadingScenePath))
{
Debug.LogError("LoadingScene路径获取失败请检查场景资源设置");
return;
}
// 配置构建选项
BuildPlayerOptions buildOptions = new BuildPlayerOptions
{
scenes = new[]
{
$"Assets/SplashScreen/EvoScenes/loading.unity",
$"{loadingScenePath}",
$"Assets/Main/main_{deviceType.ToString()}.unity"
},
locationPathName = $"Builds/Android/{PlayerSettings.applicationIdentifier}.apk",