修复资源常量脚本问题

pull/1/head
zhangxl 2024-07-19 11:31:00 +08:00
parent a4f4887da0
commit bee0cfb8c8
5 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
public static class AssetsConst public static class #CLASSNAME#
{ {
#CONSTCONTENT# #CONSTCONTENT#
} }

View File

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
public static class AssetsConst public static class AssetConst
{ {
public const string Assets_DemoGame_GameRes_AssetsConstTemplate_txt = @"Assets/DemoGame/GameRes/AssetsConstTemplate.txt"; public const string Assets_DemoGame_GameRes_AssetsConstTemplate_txt = @"Assets/DemoGame/GameRes/AssetsConstTemplate.txt";
public const string Assets_DemoGame_GameRes_AotDlls_mscorlib_dll_bytes = @"Assets/DemoGame/GameRes/AotDlls/mscorlib.dll.bytes"; public const string Assets_DemoGame_GameRes_AotDlls_mscorlib_dll_bytes = @"Assets/DemoGame/GameRes/AotDlls/mscorlib.dll.bytes";

View File

@ -12,8 +12,8 @@ namespace ZC
UniTask.Create(async () => UniTask.Create(async () =>
{ {
await ResourcesLocalComponent.Instance.LoadSceneAsync(AssetsConst.Assets_DemoGame_GameRes_Scene_Game_unity); await ResourcesLocalComponent.Instance.LoadSceneAsync(AssetConst.Assets_DemoGame_GameRes_Scene_Game_unity);
var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetsConst.Assets_DemoGame_GameRes_Entity_Cube_prefab); var loadAssetAsync = await ResourcesLocalComponent.Instance.LoadAssetAndInsAsync(AssetConst.Assets_DemoGame_GameRes_Entity_Cube_prefab);
Debug.Log("加载的是:" + loadAssetAsync); Debug.Log("加载的是:" + loadAssetAsync);
ZCGame.ProcedureManager.ChangeProcedure(ProcedureType.GameSceneLogicProcedure); ZCGame.ProcedureManager.ChangeProcedure(ProcedureType.GameSceneLogicProcedure);
}).Forget(); }).Forget();

View File

@ -1,5 +1,5 @@
using UnityEngine; using UnityEngine;
public static class AssetsConst public static class LoaderAssetConst
{ {
public const string Assets_DemoGame_GameRes_AssetsConstTemplate_txt = @"Assets/DemoGame/GameRes/AssetsConstTemplate.txt"; public const string Assets_DemoGame_GameRes_AssetsConstTemplate_txt = @"Assets/DemoGame/GameRes/AssetsConstTemplate.txt";
public const string Assets_DemoGame_GameRes_AotDlls_mscorlib_dll_bytes = @"Assets/DemoGame/GameRes/AotDlls/mscorlib.dll.bytes"; public const string Assets_DemoGame_GameRes_AotDlls_mscorlib_dll_bytes = @"Assets/DemoGame/GameRes/AotDlls/mscorlib.dll.bytes";

View File

@ -13,9 +13,11 @@ namespace Unity.Loader
{ {
public List<string> aotDllNames = new List<string>() public List<string> aotDllNames = new List<string>()
{ {
@"Assets/DemoGame/GameRes/AotDlls/mscorlib.dll.bytes", LoaderAssetConst.Assets_DemoGame_GameRes_AotDlls_mscorlib_dll_bytes,
@"Assets/DemoGame/GameRes/AotDlls/UniTask.dll.bytes", LoaderAssetConst.Assets_DemoGame_GameRes_AotDlls_Sirenix_Utilities_dll_bytes,
@"Assets/DemoGame/GameRes/AotDlls/YooAsset.dll.bytes", LoaderAssetConst.Assets_DemoGame_GameRes_AotDlls_UniTask_dll_bytes,
LoaderAssetConst.Assets_DemoGame_GameRes_AotDlls_YooAsset_dll_bytes,
LoaderAssetConst.Assets_DemoGame_GameRes_AotDlls_UnityEngine_CoreModule_dll_bytes,
}; };
private Dictionary<string, TextAsset> dlls = new Dictionary<string, TextAsset>(); private Dictionary<string, TextAsset> dlls = new Dictionary<string, TextAsset>();
@ -25,7 +27,7 @@ namespace Unity.Loader
{ {
if (true) // Dll if (true) // Dll
{ {
string dllName = @"Assets/DemoGame/GameRes/Codes/Hotfix.dll.bytes"; string dllName = LoaderAssetConst.Assets_DemoGame_GameRes_Codes_Hotfix_dll_bytes;
// Editor环境下HotUpdate.dll.bytes已经被自动加载不需要加载重复加载反而会出问题。 // Editor环境下HotUpdate.dll.bytes已经被自动加载不需要加载重复加载反而会出问题。
#if !UNITY_EDITOR #if !UNITY_EDITOR
string hotfixDll = dllName; string hotfixDll = dllName;
@ -64,7 +66,7 @@ namespace Unity.Loader
Debug.Log($"LoadMetadataForAOTAssembly:{kv.Key}. ret: {errorCode}"); Debug.Log($"LoadMetadataForAOTAssembly:{kv.Key}. ret: {errorCode}");
} }
string dllName = @"Assets/DemoGame/GameRes/Codes/Hotfix.dll.bytes"; string dllName = LoaderAssetConst.Assets_DemoGame_GameRes_Codes_Hotfix_dll_bytes;
// Editor环境下HotUpdate.dll.bytes已经被自动加载不需要加载重复加载反而会出问题。 // Editor环境下HotUpdate.dll.bytes已经被自动加载不需要加载重复加载反而会出问题。
#if !UNITY_EDITOR #if !UNITY_EDITOR
var dllAsset = this.dlls[dllName]; var dllAsset = this.dlls[dllName];