I’ve got a couple of questions from this tutorial, the first is about the SetTimer() function. I tried to look this up in the documentation under FTimerManager and I think we’re using the following (please see comments):
//From the PawnTurret class. I think this version is: https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/FTimerManager/SetTimer/5/
GetWorld()->GetTimerManager().SetTimer(FireRateTimerHandle, this, &APawnTurret::CheckFireCondition, FireRate, true);
//From the TankGameMode class. I think this version is: https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/FTimerManager/SetTimer/2/
GetWorld()->GetTimerManager().SetTimer(PlayerEnableHandle, PlayerEnableDelegate, (float)StartDelay, false);
The second one makes sense to me, but in the first one, I can’t draw the connection between what we’ve written for the 3rd parameter and what the documentation says is needed there. I can sort of see the part that says “< UserClass >::FMethodPtr” in what we’ve used, but I don’t understand the syntax in the first part of the parameter (as it’s given in the documentation).
–
The second question is about the following line in TankGameMode:
FTimerDelegate PlayerEnableDelegate =
FTimerDelegate::CreateUObject(PlayerControllerRef,
&APlayerControllerBase::SetPlayerEnabledState, true);
If I hover over “CreateUObject”, part of the pop-up says “Creates a UObject based member function delegate”. If I hover over “FTimerDelegate”, the pop-up says “Declares a delegate that can only bind to one native function at a time”. Is the function it binds to “SetPlayerEnabledState”, which “delegates” its functionality to the PlayerEnableDelegate (which we then call in the SetTimer() function below when the timer pings)?
Also, the documentation for FTimerDelegate doesn’t show any member functions, but the syntax seems to indicate that CreateUObject is a member function of FTimerDelegate. Is that correct, and where can I find the documentation that would tell me that?