You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public delegate void LuaFunction_();
[GCOptimize]
public struct LuaBootstrap
{
public LuaFunction_ Start;
public LuaFunction_ Update;
public LuaFunction_ OnDestroy;
}
public class Bootstrap : MonoBehaviour
{
private LuaBootstrap bootstrap;
报错内容为:
InvalidOperationException: try to dispose a LuaEnv with C# callback!
XLua.LuaEnv.Dispose (System.Boolean dispose) (at Assets/ThirdParty/XLua/Src/LuaEnv.cs:424)
XLua.LuaEnv.Dispose () (at Assets/ThirdParty/XLua/Src/LuaEnv.cs:393)
XluaEnv.Free () (at Assets/Script/Tool/XluaEnv.cs:39)
Bootstrap.OnDestroy () (at Assets/Script/Bootstrap.cs:40)
Lua源码:
Bootstrap={}
function Bootstrap.Start()
print("Lua:Start")
end
function Bootstrap.Update()
print("Lua:Update")
end
function Bootstrap.OnDestroy()
print("Lua:OnDestroy")
end
The text was updated successfully, but these errors were encountered:
public delegate void LuaFunction_();
[GCOptimize]
public struct LuaBootstrap
{
public LuaFunction_ Start;
public LuaFunction_ Update;
public LuaFunction_ OnDestroy;
}
public class Bootstrap : MonoBehaviour
{
private LuaBootstrap bootstrap;
上面是一个简单的生命周期代码
我不知道为什么,我如果在OnDestroy方法执行一次bootstrap.OnDestroy();哪怕后续将他设置为null,在回收还会报错
(上面执行 bootstrap其他委托在设置null还是会报错,Free()方法是单例类里的释放xluaenv方法,无其他逻辑)
报错内容为:
InvalidOperationException: try to dispose a LuaEnv with C# callback!
XLua.LuaEnv.Dispose (System.Boolean dispose) (at Assets/ThirdParty/XLua/Src/LuaEnv.cs:424)
XLua.LuaEnv.Dispose () (at Assets/ThirdParty/XLua/Src/LuaEnv.cs:393)
XluaEnv.Free () (at Assets/Script/Tool/XluaEnv.cs:39)
Bootstrap.OnDestroy () (at Assets/Script/Bootstrap.cs:40)
Lua源码:
Bootstrap={}
function Bootstrap.Start()
print("Lua:Start")
end
function Bootstrap.Update()
print("Lua:Update")
end
function Bootstrap.OnDestroy()
print("Lua:OnDestroy")
end
The text was updated successfully, but these errors were encountered: