Transfering player names to the new level after multiplayer travel

Hello. I have a lobby room of my game. From this lobby map, there is a travel happening to the actual map that the game is being played. I would like to keep the player names (value that is returned from APlayerState::GetPlayerName()) of each player state when traveling to this new map. But when after the travel has happened, the player names are reset to default (DESKTOP-xxxx).

To even better describe my issue; there are 4 players in the lobby, each of whose player states has these player names set “A”, “B”, “C” and “D”. After travelling from this lobby map to the actual game map, the player names are reset to “DESKTOP-xxxx”.

I use UWorld::ServerTravel(), with bAbsolute and bShouldSkipGameNotify set to true.

Is there any way to “transfer” these player names to the travelled map?

AGameModeBase at line 578 you will need to add that in there to copy the (old pri) states name to a (new pri) states name. along with your old state to new state. or what was called pri in the last engine.

EDIT: They extended that function to AGameMode and they add the pri there. Which takes you the a function called


void APlayerState::CopyProperties(APlayerState* PlayerState)

In that function you will find



PlayerState->SetPlayerNameInternal(GetPlayerName());


That should already be setting your name for next map. If it is wrong like you say, check there, that is where it gets set at.