【m】build apk 开发

This commit is contained in:
2025-07-02 18:14:15 +08:00
parent 15289e30c5
commit 103d1c76d4
4 changed files with 17 additions and 16 deletions

View File

@@ -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",

View File

@@ -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);
}
}

View File

@@ -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
/// 项目代号
/// </summary>
public string projectCode;
/// <summary>
/// 项目包名
/// </summary>
[ReadOnly]
public string projectPackageName;
[ReadOnly] public string projectPackageName;
#if UNITY_EDITOR
public SceneAsset loadingScene;
#endif
[ReadOnly]
public string loadingScenePath;
}
}

View File

@@ -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",