APlayerState::Reset
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: virtualoverrideENGINE_API
Description
Resets the player state to its default values. The base implementation zeros the score and clears the death count, called by the game mode when a match restarts.
Caveats & Gotchas
- • Called by AGameModeBase::ResetLevel() for all player states when the level is reset, not only when a single player dies. If you need per-death resets, use a separate function rather than overriding Reset.
- • Always call Super::Reset() to ensure score and death count are cleared. Forgetting this leaves stale stats that persist into the new match.
Signature
ENGINE_API virtual void Reset() override; Return Type
void Example
Override to reset custom stats C++
void AMyPlayerState::Reset()
{
Super::Reset();
Kills = 0;
Assists = 0;
ObjectivesCompleted = 0;
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?