【m】修改使用AssetDatabse导致的打包报错问题

1.铮哥不让我给配置文件加单例
2.这是个runtime类不能用AssetDatabse(之前没注意到)
This commit is contained in:
mzh
2026-03-31 17:08:16 +08:00
parent a30e122bff
commit dd9e8e21a4
4 changed files with 6 additions and 29 deletions

View File

@@ -20,30 +20,6 @@ namespace Stary.Evo
[TabGroup("BuildConfig")]
[InlineProperty, HideLabel]
public BuildConfig buildConfig;
private static HotfixMainResDomain globalInstance;
public static HotfixMainResDomain Get
{
get
{
// 在Resources目录下查找配置
if (globalInstance == null)
{
globalInstance = Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
}
// 无该配置时尝试创建
else if (globalInstance == null)
{
globalInstance = CreateInstance<HotfixMainResDomain>();
var path = AssetDatabase.GenerateUniqueAssetPath("Resources/HotfixMainResDomain.asset");
AssetDatabase.CreateAsset(globalInstance, path);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
// 返回热更资源配置
return globalInstance;
}
}
}
[Serializable]

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.main",
"version": "2.1.3",
"version": "2.1.4",
"displayName": "00.StaryEvo",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",

View File

@@ -27,6 +27,7 @@ namespace Stary.Evo.Editor
private string[] _scenePaths;
private string _buildAssetTagName;
private string buildAPKTagName;
private HotfixMainResDomain _hotfixMainResDomain => Resources.Load<HotfixMainResDomain>("HotfixMainResDomain");
[Title("设备类型选择", titleAlignment: TitleAlignments.Centered)] [EnumToggleButtons, HideLabel]
public DeviceType deviceType = DeviceType.Xreal;
@@ -91,7 +92,7 @@ namespace Stary.Evo.Editor
{
buildStatus = "就绪";
selectedPackageInfo = HotfixMainResDomain.Get.buildConfig.Get(packageID).info;
selectedPackageInfo = _hotfixMainResDomain.buildConfig.Get(packageID).info;
}
/// <summary>
@@ -100,7 +101,7 @@ namespace Stary.Evo.Editor
/// <param name="packageID"></param>
private void OnPackageSelectedOptionChanged(string packageID)
{
selectedPackageInfo = HotfixMainResDomain.Get.buildConfig.Get(packageID).info;
selectedPackageInfo = _hotfixMainResDomain.buildConfig.Get(packageID).info;
}
#endregion
@@ -236,7 +237,7 @@ namespace Stary.Evo.Editor
var packageID = selectionOfPackages[current];
Debug.Log($"正在打包:{packageID}");
// 获取包体配置
selectedPackageInfo = HotfixMainResDomain.Get.buildConfig.Get(packageID).info;
selectedPackageInfo = _hotfixMainResDomain.buildConfig.Get(packageID).info;
// 打包
await BuildAndroid(playMode);

View File

@@ -1,6 +1,6 @@
{
"name": "com.staryevo.tools",
"version": "1.3.33",
"version": "1.3.34",
"displayName": "00.StaryEvo.Tools",
"description": "This is an Framework package(后台服务器版本端口9527)",
"unity": "2021.3",