APlayerState::OnReactivated
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called on the server when a previously disconnected player reconnects and their inactive PlayerState is restored to the active players array.
Caveats & Gotchas
- • Only called if the PlayerState was preserved in InactivePlayerArray during disconnection — if OnDeactivated destroyed it (the default), this method is never reached.
- • At the point this is called the PlayerState is not yet assigned to a controller; do not access GetController() or GetPawn() until after the controller setup completes.
Signature
virtual void OnReactivated() Return Type
void Example
Restore transient state on player reconnect C++
void AMyPlayerState::OnReactivated()
{
Super::OnReactivated();
// Re-initialize any transient (non-replicated) state that was lost during inactivity
bHasLoadedInventory = false;
ReconnectTimestamp = GetWorld()->GetTimeSeconds();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?