How do I use RetriggerableDelay in C++?

Has anyone tried using RetriggerableDelay in C++? I can’t get it to compile. This is what I have in the .cpp file, and I’ve included the “Kismet/KismetSystemLibrary.h” header at the top:

FLatentActionInfo actionInfo;
UKismetSystemLibrary::RetriggerableDelay(NULL, 3.0f, actionInfo);

I haven’t used RetriggerableDelay, but maybe a Timer would be a sufficient replacement?


// Timer Handle to keep track of our timer
FTimerHandle TimerHandle;

// Function to call with timer
void YourFunctionToCallViaTimer();


    // Start the timer
    GetWorldTimerManager().SetTimer(TimerHandle, this, &YourClass::YourFunctionToCallViaTimer, 3.0f. true, 0.0f);

    //Do Stuff

That sounds like a good alternative, I will give that a try. Thanks staticvoidlol!

Actually, I still need RetriggerableDelay()… I need a delay in an AI task node, but a UBTTaskNode isn’t AActor, which is where the GetWorldTimerManager() is implemented.

You have to know, that you can’t put a delay in your code like in blueprints. You would stop the whole update loop

Actually, nevermind… the timer does work. It’s messed up the order of my logic but I think I can fix that later. Thank you!

I got this working. Now looking to see how to make it stop!

void randomclass::StartCoolDownCheckDelay()
	UE_LOG(AWGeneralLog, Warning, TEXT("OnCoolDownCheckDelay FIRED!!! ... "));

	FLatentActionInfo info;
	info.Linkage = 0;
	info.CallbackTarget = this;
	info.ExecutionFunction = "OnCoolDownCheckRunningStartTimer";
	info.UUID = 53344322;  //<=random number
	UKismetSystemLibrary::RetriggerableDelay(GetWorld(), 15.0f, info);

void randomclass::OnCoolDownCheckRunningStartTimer()
	UE_LOG(AWGeneralLog, Warning, TEXT("COOLDOWN FIRED!!! ... "));

Estuve lidiando con este problema durante dias.
No queria usar temporizadores para esto. haci que decidi hacer todas las pruebas necesarias hasta que funcione.

La solucion fue crear una funcion adicional exclusivamente para el delay.

    FLatentActionInfo LatentInfo;
	LatentInfo.Linkage = 0;
	LatentInfo.CallbackTarget = this;
	LatentInfo.ExecutionFunction = "FUNCION A EJECUTAR";
	LatentInfo.UUID = 100;
	UKismetSystemLibrary::Delay(this, 3.f, LatentInfo);

Ahora quedaria reemplazar la funcion que se desea ejecutar por


y esta se encargaria atravez del “LatentInfo.ExecutionFunction” de disparar la funcion deseada.

dejo esta respuesta por si alguien mas sigue teniendo problemas con esto-