Hi I’m trying to write a simple timer that I can start, pause and and stop anytime. At the moment I have’t figured out all the details about timers and this is how I have done so far:
I have defined the following in the header file:
FTimerHandle MyGameTimer;
float mytime = 0.0f;
void update_timer();
float time_increment = 0.01f;
At the begin play method I set:
GetWorldTimerManager().SetTimer(MyGameTimer,this,&AMyGameMode::update_timer, time_increment, true);
while the update_timer method does the following:
void AMyGameMode::update_timer() {
mytime = mytime + time_increment;
}
This seems to work but I was wondering if this is a proper way to do such a simple task.
Thank you