RealDocs

APlayerState::DispatchOverrideWith

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

Description

Calls the internal OverrideWith method and then fires the Blueprint-implementable ReceiveOverrideWith event, allowing both C++ and Blueprint subclasses to respond when a saved PlayerState overrides this one.

Caveats & Gotchas

  • Do not override this function directly — override OverrideWith (C++) or implement the ReceiveOverrideWith Blueprint event instead; DispatchOverrideWith is the engine's internal dispatch trampoline.
  • This is called by the GameMode when restoring an inactive PlayerState for a reconnecting player, not in seamless travel scenarios; SeamlessTravelTo handles the travel case.

Signature

void DispatchOverrideWith(APlayerState* PlayerState)

Parameters

Name Type Description Default
PlayerState APlayerState* The old PlayerState whose properties should override the current instance (used when a reconnecting player's saved state is applied).

Return Type

void

Example

Respond to property override in C++ via OverrideWith C++
// Override OverrideWith — not DispatchOverrideWith — for C++ subclasses
void AMyPlayerState::OverrideWith(APlayerState* OldState)
{
    Super::OverrideWith(OldState);
    if (AMyPlayerState* OldPS = Cast<AMyPlayerState>(OldState))
    {
        Score = OldPS->GetScore();
        CustomData = OldPS->CustomData;
    }
}

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.