SetTimer and ClearTimer Don't Work After Update to UE 4.5, help needed

Hi i was working on a game project using c++ and blueprints, i have set up the a rapid fire behavior on the c++ side using timer functions, it was working fine, but after updating my project from 4.0 to 4.5 the SetTimer and ClearTimer were broken, they don’t work anymore, this is the code that i used int he first place to activate and deactivate the timer

    GetWorldTimerManager().SetTimer(this, &AWolfRemakeCharacter::RapidFire, RapidFireTime, true);

    GetWorldTimerManager().ClearTimer(this, &AWolfRemakeCharacter::RapidFire);

these two lines are broken on the 4.5 version, after searching on the forum i found some way to use the timer and change that two lines for these two ones

    GetWorld()->GetTimerManager().SetTimer(this, &AWolfRemakeCharacter::RapidFire, RapidFireTime, true);

    GetWorld()->GetTimerManager().ClearTimer(this, AWolfRemakeCharacter::RapidFire);

but they got red underline and says: “Error: incomplete type is not allowed”

somebody can help me to fix this error ?

sorry if this is so simple, but i’m starting with the c++ side of the engine, thanks in advance for all the help.

Could you post the full error log?

the first error that i wrote in the first post is from the red underline GetWorld(), after the failed compilation the line send three errors, they are:

error C2027: use of undefined type 'FTimerManager'
error C2228: left of '.ClearTimer' must have class/struct/union
error C3867: 'AWolfRemakeCharacter::RapidFire': function call missing argument list; use '&AWolfRemakeCharacter::RapidFire' to create a pointer to member	

i fixed the problem, first i added

#include “Engine.h” (i saw that the timer function are part of the engine api and must be use the Engine.h in the headers

also i change the line code for this

    GetWorldTimerManager().ClearTimer(this, &AWolfRemakeCharacter::RapidFire);

hope this help somebody

big problem, now the game compiles fine and the timer start right away, but seems that the ClearTimer function is not working, any ideas if that function was replaced on the 4.5 update?

The function should work and you seamed to use it well, is the ‘this’ reference the same object in both the SetTimer() and ClearTimer() functions? Are they working from BPs?

sorry my mistake, i forgot to declare the onRelease event for the left mouse button, now is working fine, thanks for all the help Moss

Np dude! De nada :smiley: