Tencent / sluaunreal

lua dev plugin for unreal engine 4 or 5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tick函数不会调用

2453852330 opened this issue · comments

commented

Actor构造函数中开启

PrimaryActorTick.bCanEverTick = true;

Lua中开启

function lua_comp:ReceiveBeginPlay()
    self.bCanEverTick = true
end
function lua_comp:Tick(dt)
    print("lua comp actor Tick")
end

function lua_comp:ReceiveTick(dt)
    print("lua comp actor receive tick")
end

只有ReceiveTick会被调用,Tick是需要去Cpp手动调用吗?

用ReceiveTick,你看Tick的底层实现就明白了。它是通过C++的Tick函数再去调用蓝图的Tick(ReceiveTick),只不过蓝图的ReceiveTick名字上显示是“Tick”