AGameModeBase::GameWelcomePlayer
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtual
Description
Called when a client first connects to the server, before `PreLogin`. Use it to send the client additional connection information such as required DLC download URLs via `NMT_GameSpecific`.
Caveats & Gotchas
- • This runs before `PreLogin` — the player has not yet been accepted or rejected. Do not make gameplay decisions here; use `PreLogin` for access control.
- • Setting `RedirectURL` to a non-empty string causes the engine to automatically send an `NMT_GameSpecific` message to the client so it can download the required content. If you need richer data, use `Connection->SendRawBunch` directly.
- • The default implementation is empty; the function exists purely as an extension point for games that need custom welcome logic.
Signature
virtual void GameWelcomePlayer(UNetConnection* Connection, FString& RedirectURL) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Connection | UNetConnection* | The net connection for the joining client. | — |
| RedirectURL | FString& | Output URL for a simple content redirect. Set this string and the engine sends it automatically via NMT_GameSpecific without additional code. | — |
Return Type
void Example
Direct clients to a content redirect server C++
void AMyGameMode::GameWelcomePlayer(UNetConnection* Connection, FString& RedirectURL)
{
Super::GameWelcomePlayer(Connection, RedirectURL);
// Tell the client where to download custom map packs
RedirectURL = TEXT("http://cdn.mygame.com/packs/");
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?