Don’t use this is C++, use a Timer, via GetWorld()->GetTimerManager. You can not delay functions in c++ but you can do stuff after a set time expired, again using TimerManager.
Hi! yes I usually use Timers exactly as you say but I was curious because UKismetSystemLibrary::Delay is an available library C++ function and I just wondered about the chance of use it in C++
I’m not saying call it in BP, but it’ll need UFUNCTION markup to make the callback work. You can’t call an arbitrary C++ function with the name of the function alone. Blueprint does call functions by name, and that’s why the FLatentActionInfo takes an FName. To make Unreal aware of your function (and make it callable by name), it needs UFUNCTION markup, and it might additionally need to be marked as BlueprintCallable.
Looked it up and you may need to additionally set accion.UUID = 0; and accion.Linkage = 0;. If you’re setting multiple timers, UUID needs to be unique for each one within the same object (e.g. for the same actor). So if you’re setting multiple timers you’d probably want an int32 TimerUUID = 0; var in the class then do accion.UUID = TimerUUID++;. I think Linkage can always be zero for C++ function callbacks.