Skip to content

Enable Presence in the SDK

This how-to enables Presence in your game.

Prerequisites

Enabling Presence

Basic Presence just needs to be enabled in the SDK and the Web Console — after that, playtime data is automatically sent to LootLocker to be viewed.

Navigate to Player SettingsLootLocker SDK and select Enable Presence.

Enable Presence option in Unity Player Settings LootLocker SDK section

Presence Settings

After Presence is enabled, you can toggle settings to change some of the behavior:

  • Auto Connect: should Presence connect automatically when a LootLocker Session exists? Can be controlled at runtime with LootLockerSDKManager.SetPresenceAutoConnectEnabled(). Presence can be manually connected by calling LootLockerSDKManager.ForceStartPresenceConnection(<callback>, <optional player ulid>).
  • Auto Pause Presence: disconnects Presence when the application loses focus or is paused — useful for battery saving. Can be controlled at runtime with LootLockerSDKManager.SetPresenceAutoDiscconnectOnFocusChangeEnabled(). Presence can be manually disconnected by calling LootLockerSDKManager.ForceStopPresenceConnection(<callback>, <optional player ulid>).
  • Enable Presence in Editor: uncheck this if you don't want development to affect your Presence data.

Interact with the Presence System

For more detailed control, or to read data about the current presence connection, the SDK exposes interfaces for two main use cases: manually controlling when presence connections are made, and reading information about the presence connection.

Manual Presence Control

If auto connect is disabled in the SDK, call LootLockerSDKManager.ForceStartPresenceConnection(<callback>, <optional player ulid>) at any time after authenticating a user with LootLocker.

To disconnect, call LootLockerSDKManager.ForceStopPresenceConnection(<callback>, <optional player ulid>). To disconnect all active connections, call LootLockerSDKManager.ForceStopAllPresenceConnections().

Presence Connection Information

To check if Presence is currently connected for a player, call LootLockerSDKManager.IsPresenceConnected(<optional player ulid>), or for more granular information, call LootLockerSDKManager.GetPresenceConnectionState(<optional player ulid>).

To see detailed information about the current connection, call LootLockerSDKManager.GetPresenceConnectionStats(<optional player ulid>). This returns a struct with information such as current latency toward LootLocker and how long the connection has been running.

Conclusion

You've enabled Basic Presence in the SDK. To learn how to interpret this information, continue to View Presence in Web Console, or read up on Rich Presence and its use cases.