For whatever reason, my Tick functions will not fire in my GameModeBase.
class DELAWARE2_API ADelaware2GameModeBase : public AGameModeBase
virtual void Tick(float DeltaTime) override;
void ADelaware2GameModeBase::Tick(float DeltaTime)
UE_LOG(LogTemp, Warning, TEXT("Tick Function called!"));
FIrst, game modes only run on the server.
Second, game modes only run if you actually make them the mode for your level
Third, actors only tick if they are marked as ticking. Which maybe game mode base isn’t by default?
The documentation says:
you will need to check PrimaryActorTick.bCanEverTick is set to true to enable it
Ah. Game modes only run on the server (I thought that was GameModeBase?). So where is the appropriate place to have rules for the game?
I made it the mode for my level and I marked it as ticking.
If your game is single-player, then there’s a GameMode right there (because “single player” is actually a server, of a sort. Without the networking.)
If you have a networked game, then rules should be enforced on the server. If you need to speculate about the rules, predict outcomes, and give user feedback, then that’s more about the UI/gameplay implementation of the prediction, rather than the rules themselves.
From my experiments, GameMode and GameModeBase do NOT tick.
Moved everything to GameStateBase, and that worked out great!