Possible BUG with Timers in C++

Version 4.9.1 actually.

Before 4.9.1 my timers were executing properly now there’s a specific timer that no longer works and some others work sometimes and does not work.

It could be because of how I’m creating my timers I’m not sure if there’s now an extra step to creating timers but I use

GetWorldTimerManager().SetTimer and clear timer with it.

I also use FTimerHandle variables for specific things.

to give you an example of what I’m calling …

FTimerHandle THResetCombo,THRUpdateAnimation, THDodgeCoolDown, animationTimer;

FTimerHandle THResetCombo,THRUpdateAnimation, THDodgeCoolDown, animationTimer;

(inside my attack function)

else if (isAttacking == true && AttackAnimationPlaying == true)
	{

		flipbookframe = GetSprite()->GetPlaybackPositionInFrames();
		
		if (numOfSwings < 2)
		{

			if (flipbookframe >= 7)
			{
				
				if (!GetWorldTimerManager().TimerExists(THResetCombo);)
				{
					       GetWorldTimerManager().SetTimer(THResetCombo,this,&AWasabi_HorizonCharacter::ResetCombo, 10.0f, false);
				}

…etc… (its not calling ResetCombo)

I also have a dodge cool down in a similar way, and it works! but sometimes…it does not.

I followed it via break calls in VS2013 and found that TimerExists is always set as false( even when I set the timer number high and check to see. it always registers as false. ) so it’s a weird not making it exist and probably making a few of these timers at the same time or resetting the timer every single time. I also want to mention how often this function gets checked.(through an Update Function). if I’m not updating the function(with the class variables that work globally not locally), it works fine, but, since I’m calling the function a few times … that’s where things get weird.

Before 4.9.1 it wasn’t an issue or at least functioned in a way that did not outright give me this error. thought I’d call it in just in case. Please let me know if I’m a fool!

I noticed that when I used another different TimerHandle variable it worked just fine. I have no clue why…Every TimerHandle worked except for the first one which ended up being my THResetCombo

Hey Demoneyejin-

Are you able to reproduce this in a new project without additional content? If so can you post the steps used to setup your timer and how it’s being used in the editor?

Cheers

I actually was un-able to replicate the bug. unfortunately on an empty project it seems to be working just fine. Even on its own or with multiple handle variables. I’ll continue to see if I can replicate the bug from the game I’m working on in a cleaner source file for example.

Thank you,
Alex Batista

Hey Demoneyejin-

Are you still having problems using timers in your game or have been able to reproduce this in a new project? Let me know if you have any additional information about how the timers are not working properly. I will be marking this post as resolved for tracking purposes however feel free to add a comment to reopen it and we will continue to investigate.

Cheers