RealDocs

APlayerState::GetHumanReadableName

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

Description

Returns the player's name as a human-readable string. Overrides the AActor default to return the player name rather than the actor label.

Caveats & Gotchas

  • This calls GetPlayerName() internally, so if bUseCustomPlayerNames is set the result comes from GetPlayerNameCustom(). Use GetPlayerName() directly in most cases to avoid the virtual dispatch overhead.
  • The returned string may include additional context (like the net ID) depending on the engine build configuration. Do not parse this string — use GetPlayerName() for a clean name.

Signature

ENGINE_API virtual FString GetHumanReadableName() const override;

Return Type

FString

Example

Log player name for debugging C++
void AMyGameMode::LogPlayerAction(APlayerState* PS, const FString& Action)
{
    UE_LOG(LogGame, Log, TEXT("%s performed: %s"),
        PS ? *PS->GetHumanReadableName() : TEXT("Unknown"),
        *Action);
}

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.