RealDocs

APlayerState::IsFromPreviousLevel

function Engine Since 4.0
#include "GameFramework/PlayerState.h"
Access: public Specifiers: const

Description

Returns the literal value of the bFromPreviousLevel flag, indicating whether this PlayerState was carried over from a previous level rather than freshly created.

Caveats & Gotchas

  • This flag is distinct from the player being new to the game — a returning player is one whose state persisted through a seamless travel. Check this in GameMode::PostLogin to conditionally restore progression or skip intro sequences.
  • The flag is set by the engine during seamless travel and is not automatically cleared after you read it; you must reset it via SetIsFromPreviousLevel if you consume the value.

Signature

bool IsFromPreviousLevel() const

Return Type

bool

Example

Restore player progress after seamless travel C++
void AMyGameMode::PostLogin(APlayerController* NewPlayer)
{
    Super::PostLogin(NewPlayer);
    AMyPlayerState* PS = NewPlayer->GetPlayerState<AMyPlayerState>();
    if (PS && PS->IsFromPreviousLevel())
    {
        PS->RestorePersistentProgress();
        PS->SetIsFromPreviousLevel(false);
    }
}

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.