AGameModeBase::ResetLevel
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallable
Description
Resets the game state while remaining in the same map. Iterates all actors and calls `Reset()` on those for which `ShouldReset()` returns true.
Caveats & Gotchas
- • GameMode and Controller actors are intentionally skipped — their state is not reset, so you must handle resetting player scores or match-specific data yourself.
- • This does **not** reload the level or travel to a new map; dynamically spawned actors that were destroyed during gameplay will not be recreated automatically.
- • Calling this on a client has no effect — it must be called server-side where the GameMode lives.
Signature
ENGINE_API virtual void ResetLevel() Return Type
void Example
Reset the level after the match ends C++
void AMyGameMode::OnMatchEnded()
{
// Reset all actors (respawn pickups, restore destructibles, etc.)
ResetLevel();
// Also reset scores manually since GameMode is skipped
for (FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; ++It)
{
APlayerController* PC = It->Get();
if (PC && PC->PlayerState)
{
PC->PlayerState->SetScore(0.0f);
}
}
} See Also
Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?