Unity XLua 打包后 报xlua.access, no field __Hotfix0_Update的错误
原因:高版本Unity 不支持直接在要热更的类里直接添加[Hotfix]标签
解决方法:新建 HotfixCfg 静态类放到Editor 文件夹下
代码内容:
public static class HotfixCfg
{
//静态列表,手动将要热更新的类添加进来
[Hotfix]
public static List<Type> by_field = new List<Type>()
{
typeof(HotFixSubClass),
typeof(GenericClass<>),
};
//动态列表,自动将某程序集下某命名空间下的类都添加进来
[Hotfix]
public static List<Type> by_property
{
get
{
return (from type in Assembly.Load("Assembly-CSharp").GetTypes()
where type.Namespace == "XXXX"
select type).ToList();
}
}
}
两种方式选其一即可