我在unity3d中使用lua。我的 lualib 是KeraLua。
在 iOS 上运行时会引发错误:
ExecutionEngineException:在使用--aot-only 运行时尝试 JIT 编译方法 '(wrapper native-to-managed) PluginImport:callB (KeraLua.LuaState)'。 在 System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate (System.Delegate d) [0x00000] in :0 在 KeraLua.Lua.LuaPushStdCallCFunction (IntPtr luaState, KeraLua.LuaNativeFunction fn) [0x00000] in :0 在 PluginImport.Start () [0x00000] in :0 (文件名:行:-1)
我检查了代码:
public static void LuaPushStdCallCFunction (IntPtr luaState, LuaNativeFunction fn)
{
IntPtr pfunc = Marshal.GetFunctionPointerForDelegate (fn); // the iOS recognize this line is JIT compile method
NativeMethods.lua_pushstdcallcfunction (luaState, pfunc);
}
有没有一种好方法可以在 iOS 上的 Unity 中反转本机回调?