【m】build apk 开发
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user