Identifying Players After Non-Seamless Travel

Hi there.
I would like to identify each Player after a ServerTravel.
My first thought was to use the PlayerId within the PlayerState, but unfortunately the PlayerId changes after a ServerTravel.
Is there something else I could use to identify a Player (preferably a String or Int which I can transfer with the Options)?

When a player connects, they usually come with some form of unique id.
e.g. SteamId

Check out AGameModeBase::Login(), AGameModeBase::InitNewPlayer() etc.

When ever a player state is created, it will have have this unique id set in some way, whether that is set for the first time on a new player state or copied over from an existing one.
In either case, you should be able to find a player via this unique id even after the server changes.



FString PlayerUniqueId = <what ever>;
APlayerState* MatchingPlayerState = nullptr;

for (APlayerState* PlayerState : GetWorld()->GetGameState()->PlayerArray)
{
    if (PlayerState->UniqueId.ToString() == PlayerUniqueId)
    {
         MatchingPlayerState = PlayerState;
         break;
    }
}

if (MatchingPlayerState)
{
    bla bla bla
}