{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Event OnPostLogin in Unreal Engine 5 C++ (PostLogin)

The Blueprint Event OnPostLogin node maps to overriding the virtual PostLogin(APlayerController* NewPlayer) function on your AGameModeBase subclass in Unreal Engine 5 C++.

Blueprint node & C++ equivalent

Event OnPostLogin Blueprint node and its C++ equivalent in Unreal Engine 5
The “Event OnPostLogin” Blueprint node.
.h File
public:
	// This method gets called every time a user logs in
	virtual void PostLogin(APlayerController* NewPlayer) override;
.cpp File
void ExampleGameMode::PostLogin(APlayerController* NewPlayer)
{
	Super::PostLogin(NewPlayer);

	// Your code here...
}

What does the OnPostLogin node do?

Event OnPostLogin fires on the server every time a new player has successfully logged in and their APlayerController is fully spawned and ready. It is the standard place to run per-player join logic such as assigning teams, spawning a starting inventory, or broadcasting a join message. The NewPlayer pin gives you the controller for the player who just connected.

The C++ equivalent

In C++ you override the virtual PostLogin function declared on AGameModeBase (and AGameMode). Declare it in your .h file as virtual void PostLogin(APlayerController* NewPlayer) override; and define it in your .cpp file. Always call Super::PostLogin(NewPlayer) first so the engine completes its own player initialization before your code runs.

The signature must match exactly, including the APlayerController* parameter and the override specifier, otherwise the compiler will not bind your function to the engine's virtual call.

How to use it in C++

Create a subclass of AGameModeBase (here named ExampleGameMode), add the override to the header, then implement the body. After calling Super::PostLogin(NewPlayer), use the NewPlayer controller to access the player's pawn, player state, or to start your join logic. Because PostLogin runs only on the server, it is safe for authoritative gameplay decisions.

Frequently asked questions

What is the C++ equivalent of Event OnPostLogin in UE5?+

Override the virtual function void PostLogin(APlayerController* NewPlayer) on your AGameModeBase subclass and call Super::PostLogin(NewPlayer) inside it.

Do I need to call Super::PostLogin?+

Yes. Call Super::PostLogin(NewPlayer) first so the engine finishes its built-in login handling before your custom code runs.

When does PostLogin get called?+

It is called on the server after a player has fully logged in and their APlayerController exists, making it the right place for per-player join logic.

Related AGameModeBase nodes

View all AGameModeBase nodes →