APlayerState::SeamlessTravelTo
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called during seamless travel to copy persistent properties from this (old) PlayerState to the newly created one in the destination level.
Caveats & Gotchas
- • The default implementation calls CopyProperties — if you add custom replicated members that must survive map transitions, override CopyProperties rather than this function, as SeamlessTravelTo is only called for seamless (non-blocking) travel; non-seamless travel uses the InactivePlayerArray path instead.
- • NewPlayerState is valid but its controller is not yet assigned at call time — avoid operations that depend on possession state.
- • After this call completes the old PlayerState is destroyed; any raw pointers to it on other objects will dangle.
Signature
virtual void SeamlessTravelTo(class APlayerState* NewPlayerState) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewPlayerState | class APlayerState* | The freshly spawned PlayerState in the destination level that will replace this one. | — |
Return Type
void Example
Copy custom match stats across seamless map travel C++
void AMyPlayerState::SeamlessTravelTo(APlayerState* NewPlayerState)
{
Super::SeamlessTravelTo(NewPlayerState);
if (AMyPlayerState* NewPS = Cast<AMyPlayerState>(NewPlayerState))
{
NewPS->CareerKills = CareerKills;
NewPS->CareerDeaths = CareerDeaths;
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?