RealDocs

APlayerState::SavedNetworkAddress

property Engine Since 4.0
#include "GameFramework/PlayerState.h"
Access: public Specifiers: UPROPERTY

Description

Stores the network address of the player at the time of disconnect, used to match a reconnecting player controller back to an inactive PlayerState.

Caveats & Gotchas

  • This field is only meaningful for inactive PlayerStates (those stored in AGameMode::InactivePlayerArray). For active PlayerStates it may be empty or stale.
  • Not replicated — only meaningful on the server. Client-side reads will always be the default empty string unless you set it yourself.

Signature

UPROPERTY()
FString SavedNetworkAddress;

Example

Match reconnecting player to their old state C++
// Engine pattern: GameMode matches reconnecting player by address
// SavedNetworkAddress is set by GameMode::AddInactivePlayer()
// and compared in GameMode::FindInactivePlayer()
APlayerState* AMyGameMode::FindInactivePlayer(APlayerController* PC)
{
    FString Address = PC->GetPlayerNetworkAddress();
    for (APlayerState* PS : InactivePlayerArray)
    {
        if (PS->SavedNetworkAddress == Address)
            return PS;
    }
    return nullptr;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.