Hello guys,
I would like to set a timer which after 3 seconds will call function with params like :
GetWorldTimerManager().SetTimer(TimerHandle, this, &AGrenade::Throw(Location,Rotation), TimeBetweenThrows, true, 0.0f);
How can I call function Throw(Location, Rotation) inside timer?
I just have to make something similar to Delay node in blueprints.
Thanks guys for any help, I really struggle with it.
EvilCleric
(EvilCleric)
2
Example with 2 parameters:
void AXGameModeBase::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("AXGameModeBase"));
int param1 = 666;
FString param2 = "devil";
FTimerHandle TimerHandler;
FTimerDelegate DelegateFunc = FTimerDelegate::CreateUObject(this, &AXGameModeBase::MyFunc, param1, param2);
GetWorldTimerManager().SetTimer(TimerHandler, DelegateFunc, 2.0, false);
}
void AXGameModeBase::MyFunc(int param1, FString param2)
{
UE_LOG(LogTemp, Warning, TEXT("param1 > %d | param2 > %s "), param1, *param2);
}
thank you very much for your answer! You are real champion!