热修复
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;
[Hotfix]
public class Person
{
public void Method()
{
Debug.Log("Error");
}
}
public class TestLua : MonoBehaviour
{
void Start ()
{
LuaEnv luaEnv = new LuaEnv();
luaEnv.DoString(@"xlua.hotfix(CS.Person,'Method',function() print('Right') end)");
Person person = new Person();
person.Method();
}
}
绑定脚本。
将xLua压缩包中Tools文件夹导入项目,与Assets同级。
File ---> Build Settings… ---> Player Settings… Other Settings ---> Scripting Define Symbols*
输入HOTFIX_ENABLE
XLua ---> Generate Code
XLua ---> Hotfix Inject In Editor
运行: