This commit is contained in:
2025-11-03 12:03:21 +08:00
parent 3ba6a928cd
commit 75fb982872
25 changed files with 616 additions and 16 deletions

View File

@@ -0,0 +1,34 @@
using HybridCLR;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using YooAsset;
public class HotDllLoader : Singleton<HotDllLoader>
{
public void LoadDll(ResourcePackage package, string dll)
{
if (package.GetAssetInfo(dll).Error == string.Empty)
{
AssetHandle handle = package.LoadAssetSync<TextAsset>(dll);
#if UNITY_EDITOR
Assembly hotUpdateAss = System.AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == dll.Replace(".dll", ""));
#else
Assembly hotUpdateAss = Assembly.Load((handle.AssetObject as TextAsset).bytes);
#endif
Debug.Log($"<22><><EFBFBD><EFBFBD>{dll}");
}
}
public void LoadDepDll(ResourcePackage package, List<string> dlls)
{
foreach (string dll in dlls)
{
if (package.GetAssetInfo(dll).Error == string.Empty)
{
AssetHandle handle = package.LoadAssetSync<TextAsset>(dll);
RuntimeApi.LoadMetadataForAOTAssembly((handle.AssetObject as TextAsset).bytes, HomologousImageMode.SuperSet);
}
}
}
}