APlayerState::RegisterPlayerWithSession
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: virtualENGINE_API
Description
Registers this player with the online subsystem session identified by SessionName, allowing the platform to track the player's presence and enforce session membership.
Caveats & Gotchas
- • Called automatically from PostInitializeComponents — you should not call this manually unless you are re-registering a player after an abnormal session state change. Double-registration can cause session slots to be consumed incorrectly.
- • If UniqueId is not valid (e.g. the online subsystem is not configured, or the player is not logged in), registration is silently skipped. This means on LAN or offline builds the call is effectively a no-op.
Signature
ENGINE_API virtual void RegisterPlayerWithSession(bool bWasFromInvite); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bWasFromInvite | bool | True if this player joined via a direct invitation rather than matchmaking or server browser. | — |
Return Type
void Example
Override to register with a secondary session C++
void AMyPlayerState::RegisterPlayerWithSession(bool bWasFromInvite)
{
Super::RegisterPlayerWithSession(bWasFromInvite);
// Also register with a custom party session
if (UMyPartySubsystem* Party = GetGameInstance()->GetSubsystem<UMyPartySubsystem>())
{
Party->RegisterMember(GetUniqueId(), bWasFromInvite);
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?