华佗【huatuo】热更遇到问题汇总
华佗_github_地址
华佗(huatuo)包安装
在unity项目的packages目录的manifest.json增加
{
"dependencies":
{
},
"scopedRegistries":
[
{
"name": "package.openupm.cn",
"url": "https://package.openupm.cn",
"scopes":
[
"com.focus-creative-games.huatuo"
]
}
]
}
然后去Unity Editor的PackageManager中安装就可以了。
避免写RefTypes的方法(该方法有效,但不知道是否有副作用)
感谢Don`t worry提供的方法
1.unity版本(2020.3.33f1)
2.找到HuaTuo_BuildProcessor_2020_1_OR_NEWER.cs文件
3.增加 IIl2cppProcessor 接口并按下面的方法实现 OnBeforeConvertRun 和修改 OnFilterAssemblies 两个函数
public class HuaTuo_BuildProcessor_2020_1_OR_NEWER : IPreprocessBuildWithReport,IIl2CppProcessor
#if UNITY_ANDROID
, IPostGenerateGradleAndroidProject
#else
, IPostprocessBuildWithReport
#endif
, IProcessSceneWithReport, IFilterBuildAssemblies, IPostBuildPlayerScriptDLLs, IUnityLinkerProcessor
{
public void OnBeforeConvertRun(BuildReport report, Il2CppBuildPipelineData data)
{
try
{
foreach (var name in s_allHotUpdateDllNames)
{
File.Move("Temp/StagingArea/Data/Managed/" + name, "Temp/StagingArea/Data/Managed/_cheat_" + name);
}
}
catch (Exception e)
{
throw new BuildFailedException(e);
}
}
public string[] OnFilterAssemblies(BuildOptions buildOptions, string[] assemblies)
{
return assemblies;
// 将热更dll从打包列表中移除
//return assemblies.Where(ass => s_allHotUpdateDllNames.All(dll => !ass.EndsWith(dll, StringComparison.OrdinalIgnoreCase))).ToArray();
}
}