Enginuity
(Enginuity)
October 10, 2017, 7:22am
1
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);
Enginuity
(Enginuity)
February 28, 2018, 9:02am
3
Thanks! It still helps even though it’s old. So basically, you need to always bind delegates. Seems obvious now
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) ;
6 Likes