Tencent / sluaunreal

lua dev plugin for unreal engine 4 or 5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lua中的self.bCanEverTick似乎不起作用?(真正用法是怎样的?)

yfcyt opened this issue · comments

local LuaGameMode = {}

function LuaGameMode:ReceiveBeginPlay()
self.Super:ReceiveBeginPlay()
self.bCanEverTick = false
end

function LuaGameMode:ReceiveTick(DeltaSeconds)
print("LuaGameMode:ReceiveTick",DeltaSeconds)
end

return Class(nil, nil, LuaGameMode)

这里无论是将bCanEverTick设置为true或者false,都会执行ReceiveTick方法

在 4.26里面 有两个坑点:

  1. bCanEverTick改变了:
function DamageZoneActor:ReceiveBeginPlay()
    print("DamageZoneActor:ReceiveBeginPlay")
    
    self:SetActorTickEnabled(true)
    print(self:IsActorTickEnabled())

    self.Super:ReceiveBeginPlay()
end
  1. 需要在对应Actor蓝图里面保证Event Tick Enabled。注册任意函数再删掉,Compile蓝图即可。
    image

在 4.26里面 有两个坑点:

  1. bCanEverTick改变了:
function DamageZoneActor:ReceiveBeginPlay()
    print("DamageZoneActor:ReceiveBeginPlay")
    
    self:SetActorTickEnabled(true)
    print(self:IsActorTickEnabled())

    self.Super:ReceiveBeginPlay()
end
  1. 需要在对应Actor蓝图里面保证Event Tick Enabled。注册任意函数再删掉,Compile蓝图即可。
    image

确实是这样的,3q!
我用的ue 5.3.2版本,也是如此~