Skip to main content

Updating presence

For players that are signed in with an Epic Games account (or have at least one delegated subsystem that supports presence), you can update a player's status information in-game.

This is useful for displaying information such as whether the player is in a lobby, in matchmaking or in the middle of a game.

caution

Presence updates won't work for Epic Games accounts until your game has gone through Brand Approval.

Update the player's status

To update a player's status, use the SetPresence function on the presence interface, like so:

IOnlineSubsystem *Subsystem = Online::GetSubsystem(this->GetWorld());
IOnlineIdentityPtr Identity = Subsystem->GetIdentityInterface();
IOnlinePresencePtr Presence = Subsystem->GetPresenceInterface();

FOnlineUserPresenceStatus Status;
Status.State = EOnlinePresenceState::Online;
Status.StatusStr = TEXT("This is my custom status!");

Presence->SetPresence(
*Identity->GetUniquePlayerId(0).Get(),
Status,
IOnlinePresence::FOnPresenceTaskCompleteDelegate::CreateLambda([](
const class FUniqueNetId &UserId,
const bool bWasSuccessful)
{
// Check bWasSuccessful.
}));

View player presence information

The presence status that you set will be visible in the Epic Games launcher, and in the Epic Games Social Overlay. For example:

A custom status appearing in the Epic Games Launcher friends list

To query presence in game, refer to Querying presence information of other users.