AGameModeBase::Reset
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualoverride
Description
Overrides AActor::Reset to reinitialize the game state. The GameMode's Reset re-initializes the GameState and resets the match, effectively restarting the game within the same level without a map reload.
Caveats & Gotchas
- • Do not call this to restart a multiplayer match mid-game without coordinating with all clients — the reset happens server-side, but clients may be mid-animation or mid-UI flow when it fires, causing visual glitches.
- • ResetLevel is the higher-level call that invokes Reset on all actors including the GameMode. If you want to reset the full game state, call ResetLevel rather than calling GameMode::Reset directly.
- • The base implementation calls InitGameState, which reinitializes the GameState actor. Any custom state you have stored directly on the GameMode (not on GameState) will not be automatically cleared — your override must handle that.
Signature
ENGINE_API virtual void Reset() override; Return Type
void Example
Reset with custom cleanup C++
void AMyGameMode::Reset()
{
Super::Reset();
// Clear round-specific tracking
RoundNumber = 0;
TeamScores.Reset();
// Re-enable any disabled actors
for (AMyObjective* Obj : ObjectiveActors)
{
if (Obj) Obj->Reactivate();
}
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?