AGameModeBase::DefaultPlayerName
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: UPROPERTYEditAnywhere
Description
The player name assigned to any player who joins without specifying a name in the URL options. Set this in Project Settings or the GameMode subclass defaults.
Caveats & Gotchas
- • This is an FText rather than FString, so it supports localization — if your game ships in multiple languages, you can provide translated default names via string tables.
- • The name is applied during Login() before PostLogin() is called. Overriding ChangeName() after login will not retroactively change players who already received the default name during that same session.
- • Players can override this at join time via the '?Name=xxx' URL option, which takes precedence over DefaultPlayerName.
Signature
UPROPERTY(EditAnywhere, Category=Game)
FText DefaultPlayerName; Example
Setting a default name in C++ C++
AMyGameMode::AMyGameMode()
{
DefaultPlayerName = FText::FromString(TEXT("Player"));
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?