From 103d1c76d43787ee2dbf61eb09ebdbb93d021a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=93=AE?= <834207172@qq.com> Date: Wed, 2 Jul 2025 18:14:15 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90m=E3=80=91build=20apk=20=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/00.StaryEvo/Editor/Build/BuildApkWindow.cs | 14 +------------- .../Editor/Entity/HotfixMainResDomainEditor.cs | 8 ++++++++ .../Runtime/PlayerSettings/HotfixMainResDomain.cs | 9 +++++++-- Assets/00.StaryEvo/package.json | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Assets/00.StaryEvo/Editor/Build/BuildApkWindow.cs b/Assets/00.StaryEvo/Editor/Build/BuildApkWindow.cs index d752a1c..db526e4 100644 --- a/Assets/00.StaryEvo/Editor/Build/BuildApkWindow.cs +++ b/Assets/00.StaryEvo/Editor/Build/BuildApkWindow.cs @@ -86,29 +86,17 @@ public class BuildApkWindow : OdinEditorWindow 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[] { - $"{loadingScenePath}", + hotfixMainResDomain.projectInfo.loadingScenePath, $"Assets/Main/main_{deviceType.ToString()}.unity" }, locationPathName = $"Builds/Android/{PlayerSettings.applicationIdentifier}.apk", diff --git a/Assets/00.StaryEvo/Editor/Entity/HotfixMainResDomainEditor.cs b/Assets/00.StaryEvo/Editor/Entity/HotfixMainResDomainEditor.cs index 2807efe..fee5917 100644 --- a/Assets/00.StaryEvo/Editor/Entity/HotfixMainResDomainEditor.cs +++ b/Assets/00.StaryEvo/Editor/Entity/HotfixMainResDomainEditor.cs @@ -25,5 +25,13 @@ public class HotfixMainResDomainEditor : UnityEditor.Editor base.OnInspectorGUI(); HotfixMainResDomain hotfixMainResDomain = (HotfixMainResDomain)target; hotfixMainResDomain.projectInfo.projectPackageName = $"com.xosmo.{hotfixMainResDomain.projectInfo.projectCode}"; + + if (hotfixMainResDomain.projectInfo.loadingScene == null) + { + Debug.LogError("HotfixMainResDomain 资源中loadingScene索引不存在,请检查!"); + return; + } + // 获取loadingScene的Assets相对路径 + hotfixMainResDomain.projectInfo.loadingScenePath = AssetDatabase.GetAssetPath(hotfixMainResDomain.projectInfo.loadingScene); } } \ No newline at end of file diff --git a/Assets/00.StaryEvo/Runtime/PlayerSettings/HotfixMainResDomain.cs b/Assets/00.StaryEvo/Runtime/PlayerSettings/HotfixMainResDomain.cs index b974eaa..5f98e68 100644 --- a/Assets/00.StaryEvo/Runtime/PlayerSettings/HotfixMainResDomain.cs +++ b/Assets/00.StaryEvo/Runtime/PlayerSettings/HotfixMainResDomain.cs @@ -20,6 +20,7 @@ namespace Stary.Evo public string username = "UnityHot"; public string password = "Unity1234"; } + [Serializable] public class ProjectInfo { @@ -32,14 +33,18 @@ namespace Stary.Evo /// 项目代号 /// public string projectCode; + /// /// 项目包名 /// - [ReadOnly] - public string projectPackageName; + [ReadOnly] public string projectPackageName; +#if UNITY_EDITOR public SceneAsset loadingScene; +#endif + [ReadOnly] + public string loadingScenePath; } } \ No newline at end of file diff --git a/Assets/00.StaryEvo/package.json b/Assets/00.StaryEvo/package.json index 04ff1c3..4823ace 100644 --- a/Assets/00.StaryEvo/package.json +++ b/Assets/00.StaryEvo/package.json @@ -1,6 +1,6 @@ { "name": "com.staryevo.main", - "version": "1.3.11", + "version": "1.3.12", "displayName": "00.StaryEvo", "description": "This is an Framework package(后台服务器版本,端口9527)", "unity": "2021.3",