sluaunreal icon indicating copy to clipboard operation
sluaunreal copied to clipboard

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

Open yfcyt opened this issue 11 months ago • 2 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方法

yfcyt avatar Mar 05 '24 11:03 yfcyt

在 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

liubai01 avatar Mar 09 '24 13:03 liubai01

在 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版本,也是如此~

yfcyt avatar Mar 18 '24 07:03 yfcyt