It just that i have to write a long line and then declare a function in the header and implement it in the cpp file only to make a simple delay.
In javascript for example you can do something like that:

setTimeout(function()
{
...
},300);

But when i tried to use lambda within the timer function it says it couldn’t convert what he needs to lambda.
Is it really have to be such a mess only to make a simple delay ?

 

 

 

FTimerDelegate TimerCallback;
TimerCallback.BindLambda([]
{
	// callback;
});

FTimerHandle Handle;
GetWorld()->GetTimerManager().SetTimer(Handle, TimerCallback, 5.0f, false);

 

Inrate 에 대한 설명  == /** Time between set and fire, or repeat frequency if looping. */

 

 

 

Is this what you’re looking for?

 

 

 

 

If you want an inline callback, you can do the following:

GetWorld()->GetTimerManager().SetTimer(Handle, FTimerDelegate::CreateLambda([] { /* callback; */ }), 5.0f, false);

 

 

 

ref : https://forums.unrealengine.com/t/can-i-use-lambda-with-timers/30620

 

Can i use lambda with timers?

It just that i have to write a long line and then declare a function in the header and implement it in the cpp file only to make a simple delay. In javascript for example you can do something like that: setTimeout(function() { ... },300); But when i tried

forums.unrealengine.com

 

 

33님 댓글 

GetWorldTimerManager().SetTimer(FTimerhandle,[this]{ bla bla bal },InRate,Loop);



반응형

'게임엔진(GameEngine) > Unreal4' 카테고리의 다른 글

블루프린트에서의 멀티플레이어  (0) 2022.07.13
UE5 특징  (0) 2022.06.16
비히클 셋업  (0) 2022.03.16
check(표현식);  (0) 2022.03.03
문자 변환  (0) 2022.02.10

+ Recent posts