feat: configurable multi-user session mode#468
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new configuration setting (LootLockerMultiUserSessionMode) to control how the SDK treats “default/active player” selection when multiple authentications occur, aiming to reduce confusion from previously-cached default players.
Changes:
- Introduces
LootLockerMultiUserSessionModeand addsmultiUserSessionModetoLootLockerConfig, including editor-time pre-migration persistence fromNotSet. - Updates
LootLockerStateData._SetPlayerData()to branch player cache/default behavior based on the configured session mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Runtime/Game/Resources/LootLockerConfig.cs | Adds the multi-user session mode enum + config field, and editor-time migration/persistence for existing projects/new installs. |
| Runtime/Client/LootLockerStateData.cs | Alters player state persistence/default-player rules based on the configured multi-user session mode. |
85d3b4e to
eae0735
Compare
- Add LootLockerMultiUserSessionMode enum (Hotseat/SingleSession/ProfileSwitching/NotSet) at namespace scope in LootLockerConfig.cs - Add multiUserSessionMode config field with detailed inspector tooltip - Add [InitializeOnLoadMethod] pre-migration: NotSet resolves to Hotseat (existing projects with API key) or SingleSession (new installs) and is persisted to the asset - Modify _SetPlayerData to apply session mode: - SingleSession: clears all previous state before saving, always sets new player as default - ProfileSwitching: deactivates other players (keeps cold cache), sets new player as default - Hotseat (default): preserves existing behaviour, first auth in session is default
- SingleSession: save new player first, then wipe others via _ClearAllSavedStatesExceptForPlayer to prevent data loss on IO failure - ExternalFileConfig: add multi_user_session_mode field - Config.Get(): apply multi_user_session_mode from external file config (only if != NotSet) - CheckForSettingOverrides: add -multiusersessionmode command-line override
NotSet is now resolved the same way migration does: no API key → SingleSession, otherwise Hotseat.
5580e5b to
d609d1a
Compare
JohannesLoot
left a comment
There was a problem hiding this comment.
All good, merge away!
|
From previous discussion: |
Fixed |
Summary
Resolves lootlocker/index#1521
Adds a configurable
LootLockerMultiUserSessionModeenum toLootLockerConfigthat controls how the SDK handles new authentications with respect to the active/default player. This addresses the common developer confusion where requests go to the "wrong player" because a previously-cached default persists across sessions.New setting: Multi User Session Mode
Three modes are available:
Backwards compatibility
A
NotSetsentinel value handles the pre-migration case:[InitializeOnLoadMethod]checks whether an API key is already configured:Hotseat— no behaviour changeSingleSessionChanges
Runtime/Game/Resources/LootLockerConfig.csLootLockerMultiUserSessionModeenum at namespace scope (NotSet,Hotseat,SingleSession,ProfileSwitching)multiUserSessionModeconfig field with detailed[Tooltip]explaining each mode[InitializeOnLoadMethod]Runtime/Client/LootLockerStateData.cs_SetPlayerData()branches on the configured mode:SingleSession: clears all previous state before saving the new playerProfileSwitching: deactivates all other players (cold cache kept), sets new player as defaultHotseat/NotSet: preserves the previous first-auth-is-default behaviour