Tencent / sluaunreal

lua dev plugin for unreal engine 4 or 5
Other
1.77k stars 420 forks source link

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

Open yfcyt opened 6 months ago

yfcyt commented 6 months ago

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方法

liubai01 commented 6 months ago

在 4.26里面 有两个坑点:

  1. bCanEverTick改变了:

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

yfcyt commented 6 months ago

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