Enable Presence in the SDK

This how-to walks you through how to enable 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 will automatically be sent to LootLocker to be viewed.

Navigate to Player Settings -> LootLocker SDK. Select Enable Presence

Presence Settings

After Presence is enabled, you can toggle settings to change some of the behaviour.

  • Auto Connect

    • Should Presence be connected 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

    • Disconnect Presence when 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 do not 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 there are some interfaces in the SDK you can interact with. The two main use cases are:

  • Manual control of when presence connections are made.

  • Read information about the presence connection.

Manual Presence Control

Presence Methods

If auto connect is disabled in the SDK, then when you have authenticated a user with LootLocker you can at any time call LootLockerSDKManager.ForceStartPresenceConnection(<callback>, <optional player ulid>).

To disconnect, call LootLockerSDKManager.ForceStopPresenceConnection(<callback>, <optional player ulid>).

To disconnect all active connections call LootLockerSDKManager.ForceStopAllPresenceConnections().

Presence Connection Information

Presence Methods

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 for a player, call LootLockerSDKManager.GetPresenceConnectionStats(<optional player ulid>). This will give you a struct with lots of interesting information, such as the current latency towards LootLocker and how long the connection has been running.

Conclusion

In this how-to we have enabled Basic Presence in the SDK. To learn how to interpret this information, continue to the View Presence in Web Console or continue to read up on Rich Presence and it's use cases.

Last updated