Files
2025-10-31 15:31:34 +08:00

33 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System;
using System.IO;
using System.Text;
public class CopyHotDll
{
[MenuItem("Tools/生成热更Dll二进制文件")]
public static void CreateDllByte()
{
HybridCLR.Editor.Commands.CompileDllCommand.CompileDllActiveBuildTarget();
BuildTarget buildTarget = UnityEditor.EditorUserBuildSettings.activeBuildTarget;
foreach (var dll in Boot.Inst.dllMap)
{
string sourcePath = dll.Value == 0 ?
$"{KeyManager.TDllSourceDir}/{buildTarget}/{dll.Key}.dll" :
$"{KeyManager.HotDllSourceDir}/{buildTarget}/{dll.Key}.dll";
string destPath = $"{KeyManager.AssetDllDir}/{dll.Key}.dll.bytes";
if (File.Exists(destPath))
File.Delete(destPath);
File.Copy(sourcePath, destPath);
AssetDatabase.Refresh();
Debug.Log($"copy {sourcePath} to {destPath}");
}
Debug.Log($"生成热更Dll二进制文件结束");
}
}