How can I use Seamless Travel to persist data across map changes?

Hi guys,

I have been trying to get this Seamless Travel business working for some time now.

It appears that even after travelling “seamlessly” that all data on the PlayerControllers and PlayerStates are reset to their defaults and BeginPlay() is called on everything again. (Not sure if BeginPlay is intended by the engine, but I’ve been reading that PlayerStates should be able to keep data so that players can end up on the same team for example)

What are steps to troubleshoot this and get this data persistence working?

Thanks!

PS:
I am calling SeamlessTravel on the World object, and have verified that the PlayerStates and GameState get added to the list of Actors to keep.

Override CopyProperties on PlayerState

Contrary to what I read, the PlayerState and GameState objects are not actually saved from one map to the next.

More accurately new ones are created and relevant data copied across.

Didn’t look too far into GameState, but for PlayerState you have to manually specify how to copy your data to the new PlayerState when seamless travel occurs:

In your custom PlayerState class, override CopyProperties to copy all your values across to the new object.

virtual void CopyProperties(class APlayerState* PlayerState);

void AMyPlayerState::CopyProperties(class APlayerState* PlayerState)
{
	APlayerState::CopyProperties(PlayerState);

	AMyPlayerState* myPlayerState = Cast<AMyPlayerState>(PlayerState);

	if (myPlayerState)
	{
                // Copy all the properties that you want to keep across map change here
		myPlayerState->variable = variable;
	}
}

The only other requirement is actually calling ServerTravel on the World to change map and setting bUseSeamlessTravel = true on your GameMode.

Surprised that there seems to be no documentation regarding any of this.

Can’t get it to work, even though i implement CopyProperties and set the bUseSeamlessTravel = true.
Is there anythingelse i need to do?
I’ve done a really simple project here:

Have you set a transition map?

The properties must be public if you wanna copy them in the CopyProperties method.

THANK YOU! Was stumped till I read this.

I don’t understand how to do this

set the bUseSeamlessTravel = true

Where is this done? If it is in Visual Studio in the CPP source code where exactly ? I’m not a CPP person mostly working in Blueprints so this is quite scary for me to mess around with this. However i’m trying to make a VR experience and need to get rid of that annoying loading screen. So i’m planning on using a Transition map but one of the steps requires

set the bUseSeamlessTravel = true

and i can’t figure it out.

Please help.

Thanks.

Hi amitvfx,

In cpp the public member variable bUseSeamlessTravel is on the GameMode object, declared here:
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Engine/Classes/GameFramework/GameModeBase.h#L533

Or you can open your GameMode blueprint and check it under the Game Mode category:

190349-seamlesstravel.png