SetTimerForNextTick proper syntax?

I’m trying to use SetTimerForNextTick to call another function in the same class the following tick:

{ //doing stuff
 
 FTimerHandle UnusedHandle;
 GetWorldTimerManager().SetTimerForNextTick(UnusedHandle,
 this, &UMyCharacterMovement::
 DoneDodging); //bWantsToDodge = false;
 } }
 
 void UMyCharacterMovement::
 DoneDodging() { bWantsToDodge = false;
 }

However, I’m not using the SetTimerForNextTick correctly and get the following errors:

 error C3861: 'GetWorldTimerManager':
 identifier not found

 error C2228: left of
 '.SetTimerForNextTick' must have
 class/struct/union

 note: type is 'unknown-type'

Does anyone know what’s wrong with my syntax?

I know this is old, but I managed to get it working so adding a note in case it trips anyone else up.

FTimerDelegate TimerDelegate;
TimerDelegate.BindUFunction(this, FName("MyFunctionToCall"));
GetWorld()->GetTimerManager().SetTimerForNextTick(TimerDelegate);

Thanks! It still helps even though it’s old. So basically, you need to always bind delegates. Seems obvious now :slight_smile:

1 Like

Here is the syntax. Using the marked answer only adds more code and is a work around for not knowing the syntax. Use this instead.

GetWorld()->GetTimerManager().SetTimerForNextTick(this ,&UHorrorEvent::OnFinishedPlaying) ;

3 Likes