Hello!
I’m new to C++ and UE. And I ran into a problem while trying to use SetTimer().
In my case:
GetWorld()->GetTimerManager().SetTimer(ReloadTimer, this, &ACannon::Reload(), 1/FireRate, false);
IDE Keeps getting an Error: Cannot apply operator ‘&’ to r-value. The issue is here &ACannon::Reload() but I’m not sure how to ssolve it.
ACannon::Reload() means calling the function. You need to pass function pointer to SetTimer(…).
So new code should be :
GetWorld()->GetTimerManager().SetTimer(ReloadTimer, this, &ACannon::Reload, 1/FireRate, false);
2 Likes