Skip to content

Using Rich Presence In Game

This how-to walks you through how to use rich presence in your game.

Prerequisites

Rich Presence

Rich Presence does not require any changes for setup in the SDK.

Sending Status Changes

When sending state changes for a player, you need to provide:

  • A status name
    • E.g. "main_menu", "level_1", "settings_menu"
  • Metadata (Optional)
    • You can include metadata when sending the state update
      • E.g. "build_version", "game_fps_count"

Sending a Presence status is as simple as calling a function.

// Example code of a function being called when the player enters a Game Over state
public void SendGameOverPresenceStatus()
{
Dictionary<string, string> presenceDetails = new Dictionary<string, string>()
{
{"device", SystemInfo.deviceModel },
{"unity_version", Application.unityVersion}
};
LootLockerPresenceManager.UpdatePresenceStatus("game_over", presenceDetails);
}

Out of Focus / Pause behaviour

When Auto Connect and Disconnect On Pause is enabled Presence will reconnect and resend the last status that was sent when Presence reconnects.

Conclusion

In this how-to we have used Rich Presence to send a change of game status. To learn how to interpret this information, continue to the View Presence in Web Console.