Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua重写ReceiveBeginPlay,加上蓝图调用【父类:ReceiveBeginPlay】的时候,会出问题 #722

Open
shuitian opened this issue Aug 23, 2024 · 2 comments

Comments

@shuitian
Copy link

测试环境:
蓝图类

  1. DebugBattleBug
    只连了ReceiveBeginPlay
    image
    父类实现了unlua插件
    image

  2. DebugBattleBug_Child
    是DebugBattleBug的子类,蓝图里调用了父类的ReceiveBeginPlay
    image

  3. lua代码中,实现了ReceiveBeginPlay
    image

  4. 在测试场景中拖入两个DebugActor
    image

  5. 开始运行,会出问题

由于这里调用父类的ReceiveBeginPlay,实际上会调用到lua中去,又会调用到子类蓝图中,疑似出现死循环?

@HuaNanHYC
Copy link

HuaNanHYC commented Sep 2, 2024

对的,因为编辑器在运行时检测到UObject才会绑定Lua文件;
如果世界中只有Child,那么父类的ReceiveBeginPlay就只是一个打印字符串,Child中调用的父类函数只是打印字符串;
但是父类也放到世界中运行时就会绑定,父类的ReceiveBeginPlay就变成了self.Overridden.ReceiveBeginPlay(self),那在Child的ReceiveBeginPlay中调用的就是self.Overridden.ReceiveBeginPlay(self),会形成死循环。

@BaconVN
Copy link

BaconVN commented Sep 19, 2024

Cherry pick this PR. This should solve the problem.

#719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants