APlayerState::UnregisterPlayerWithSession
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: virtualENGINE_API
Description
Removes this player from the current online session via the online subsystem. Called automatically on destroy; override to customize session departure behavior.
Caveats & Gotchas
- • Only executes meaningful work on the server — client-side calls have no effect on the session registry.
- • If your game uses a custom online subsystem or session interface, you must override this to ensure players are properly deregistered; the default implementation calls the engine's session interface which may not cover all backends.
- • Failing to call this (e.g., if you suppress Destroyed) can leave stale session entries that prevent new players from joining a full-looking but not-actually-full session.
Signature
virtual void UnregisterPlayerWithSession() Return Type
void Example
Override to add custom cleanup before session removal C++
void AMyPlayerState::UnregisterPlayerWithSession()
{
// Flush any pending stat writes before the session entry is removed
SavePlayerStats();
Super::UnregisterPlayerWithSession();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?