Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
我有 BP_Child 和 BP_Base,它们分别绑定到 Child.lua 和 Base.lua。Child.lua 和 Base.lua 都重写了 FunctionA()。当我在 BP_Child 中调用 FunctionA() 时,它导致了无限循环错误。根本原因是,当执行到 BP_Base 中的 FunctionA 时,由于 Base.lua 重写了 FunctionA(),UnLua 决定再次触发 FunctionA(),这就导致了一个无限循环。你可以看下面的图表来直观理解。
我在调用 LuaFunction 时添加了检查,判断调用的 ULuaFunction 是否来自父类,且与对象的 UClass 不是同一个类。这就是为什么我们跳过调用 Lua 端,而是调用被重写的函数,以防止继承相关的 bug。