APlayerState::SetIsInactive
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: ENGINE_API
Description
Sets the inactive flag on the PlayerState and replicates it via OnRep_bIsInactive. Called internally by the engine when managing the InactivePlayerArray; rarely needed in game code.
Caveats & Gotchas
- • This is an engine-internal operation — calling it directly without also managing the InactivePlayerArray and controller lifetime will leave the game in an inconsistent state.
- • Setting to true does not remove the actor from GameState->PlayerArray automatically; the engine's GameMode handles that separately when processing disconnects.
Signature
void SetIsInactive(const bool bNewInactive) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bNewInactive | const bool | True to mark this PlayerState as inactive (player disconnected), false when reactivating on reconnect. | — |
Return Type
void Example
Manually reactivate a stored PlayerState in a custom reconnect flow C++
// In a custom GameMode reconnect handler
void AMyGameMode::HandleReconnectingPlayer(APlayerState* InactivePS, APlayerController* NewPC)
{
InactivePS->SetIsInactive(false);
InactivePS->DispatchOverrideWith(NewPC->GetPlayerState<APlayerState>());
// Assign InactivePS to NewPC, etc.
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?