Skip to content

Commit 428fb82

Browse files
author
Rene Damm
authored
DOCS: Remove docs around platformUserAccount (#1400).
1 parent 78843dd commit 428fb82

File tree

4 files changed

+6
-188
lines changed

4 files changed

+6
-188
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ however, it has to be formatted properly to pass verification tests.
1414

1515
- Fixed `InvalidCastException: Specified cast is not valid.` and `InvalidOperationException: Already have an event buffer set! Was OnUpdate() called recursively?` when upgrading from 1.1.0-pre.5 or earlier. If you experience this issue you can also restart the editor to resolve it.
1616
- Fixed `InputDeviceChange.Destroyed` not being available, now it's correctly marked as obsolete instead.
17+
- Removed documentation around platform user account management of `InputUser` which was ahead of actual backend support for the feature.
1718

1819
## [1.1.0] - 2021-08-27
1920

Packages/com.unity.inputsystem/Documentation~/UserManagement.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Input System supports multi-user management through the [`InputUser`](../api
44

55
>__Note__: The user management API is quite low-level in nature. The stock functionality of [`PlayerInputManager`](Components.md#playerinputmanager-component) (see [Components](./Components.md)) provides an easier way to set up user management. The API described here is useful when you want more control over user management.
66
7-
In the Input System, each [`InputUser`](../api/UnityEngine.InputSystem.Users.InputUser.html) represents a human interacting with the application. For example, you can have multiple users playing a game together on a single computer or device (local multiplayer), where each user has one or more [paired Input Devices](#device-pairing). A user might be associated with a platform [user account](#user-account-management), if the platform and Devices support it.
7+
In the Input System, each [`InputUser`](../api/UnityEngine.InputSystem.Users.InputUser.html) represents a human interacting with the application. For example, you can have multiple users playing a game together on a single computer or device (local multiplayer), where each user has one or more [paired Input Devices](#device-pairing).
88

99
The [`PlayerInputManager`](Components.md#playerinputmanager-component) class uses [`InputUser`](../api/UnityEngine.InputSystem.Users.InputUser.html) internally to handle users.
1010

@@ -34,16 +34,6 @@ If paired Input Devices disconnect during the session, the system notifies the [
3434

3535
To get notifications about these changes, subscribe to the [`InputUser.onChange`](../api/UnityEngine.InputSystem.Users.InputUser.html#UnityEngine_InputSystem_Users_InputUser_onChange) event.
3636

37-
## User account management
38-
39-
The Input System can associate a user with a platform-specific user account, if both the platform and the Devices support this. Consoles commonly support this functionality. Platforms that support user account association are Xbox One, PlayStation 4, Nintendo Switch, and UWP.
40-
41-
Use the [`platformUserAccountHandle`](../api/UnityEngine.InputSystem.Users.InputUser.html#UnityEngine_InputSystem_Users_InputUser_platformUserAccountHandle) property to query the associated user account for an [`InputUser`](../api/UnityEngine.InputSystem.Users.InputUser.html). This property gets determined when the user is first [paired to a Device](#device-pairing), and the Device has any platform user information the Input System can query.
42-
43-
The account associated with an InputUser might change if the player uses the platform's facilities to switch to a different account ([`InputUser.onChange`](../api/UnityEngine.InputSystem.Users.InputUser.html#UnityEngine_InputSystem_Users_InputUser_onChange) receives an `InputUserChange.AccountChanged` notification).
44-
45-
Note that for WSA/UWP apps, the *User Account Information* capability must be enabled for the app in order for user information to come through on input devices.
46-
4737
## Debugging
4838

4939
Check the debugger documentation to learn [how to debug active users](Debugging.md#debugging-users-and-playerinput).

Packages/com.unity.inputsystem/InputSystem/Plugins/Users/InputUser.cs

Lines changed: 3 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@ namespace UnityEngine.InputSystem.Users
2929
/// This can be useful in setups such as split-keyboard (e.g. one user using left side of keyboard and the
3030
/// other the right one) use or hotseat-style gameplay (e.g. two players taking turns on the same game controller).
3131
///
32-
/// A user may be associated with a platform user account (<see cref="platformUserAccountHandle"/>), if supported by the
33-
/// platform and the devices used. Support for this is commonly found on consoles. Note that the account
34-
/// associated with an InputUser may change if the player uses the system's facilities to switch to a different
35-
/// account (<see cref="InputUserChange.AccountChanged"/>). On Xbox and Switch, this may also be initiated from
36-
/// the application by passing <see cref="InputUserPairingOptions.ForcePlatformUserAccountSelection"/> to
37-
/// <see cref="PerformPairingWithDevice"/>.
38-
///
39-
/// Platforms that support user account association are <see cref="RuntimePlatform.XboxOne"/>,
40-
/// <see cref="RuntimePlatform.PS4"/>, <see cref="RuntimePlatform.Switch"/>, <see cref="RuntimePlatform.WSAPlayerX86"/>,
41-
/// <see cref="RuntimePlatform.WSAPlayerX64"/>, and <see cref="RuntimePlatform.WSAPlayerARM"/>. Note that
42-
/// for WSA/UWP apps, the "User Account Information" capability must be enabled for the app in order for
43-
/// user information to come through on input devices.
44-
///
4532
/// Note that the InputUser API, like <see cref="InputAction"/>) is a play mode-only feature. When exiting play mode,
4633
/// all users are automatically removed and all devices automatically unpaired.
4734
/// </remarks>
@@ -107,62 +94,13 @@ public int index
10794
/// The ID of a user is internally assigned and cannot be changed over its lifetime. No two users, even
10895
/// if not concurrently active, will receive the same ID.
10996
///
110-
/// Note that this is not the same as the platform's internal user ID (if relevant on the current
111-
/// platform). To get the ID that the platform uses to identify the user, use <see cref="platformUserAccountHandle"/>.
112-
///
11397
/// The ID stays valid and unique even if the user is removed and no longer <see cref="valid"/>.
11498
/// </remarks>
115-
/// <seealso cref="platformUserAccountHandle"/>
11699
public uint id => m_Id;
117100

118-
/// <summary>
119-
/// If the user is is associated with a user account at the platform level, this is the handle used by the
120-
/// underlying platform API for the account.
121-
/// </summary>
122-
/// <remarks>
123-
/// Users may be associated with user accounts defined by the platform we are running on. Consoles, for example,
124-
/// have user account management built into the OS and marketplaces like Steam also have APIs for user management.
125-
///
126-
/// If this property is not <c>null</c>, it is the handle associated with the user at the platform level. This can
127-
/// be used, for example, to call platform-specific APIs to fetch additional information about the user (such as
128-
/// user profile images).
129-
///
130-
/// Be aware that there may be multiple InputUsers that have the same platformUserAccountHandle in case the platform
131-
/// allows different players to log in on the same user account.
132-
/// </remarks>
133-
/// <seealso cref="platformUserAccountName"/>
134-
/// <seealso cref="platformUserAccountId"/>
135-
/// <seealso cref="InputUserChange.AccountChanged"/>
101+
////TODO: bring documentation for these back when user management is implemented on Xbox and PS
136102
public InputUserAccountHandle? platformUserAccountHandle => s_GlobalState.allUserData[index].platformUserAccountHandle;
137-
138-
/// <summary>
139-
/// Human-readable name assigned to the user account at the platform level.
140-
/// </summary>
141-
/// <remarks>
142-
/// This property will be <c>null</c> on platforms that do not have user account management. In that case,
143-
/// <see cref="platformUserAccountHandle"/> will be <c>null</c> as well.
144-
///
145-
/// On platforms such as Xbox, PS4, and Switch, the user name will be the name of the user as logged in on the platform.
146-
/// </remarks>
147-
/// <seealso cref="platformUserAccountHandle"/>
148-
/// <seealso cref="platformUserAccountId"/>
149-
/// <seealso cref="InputUserChange.AccountChanged"/>
150-
/// <seealso cref="InputUserChange.AccountNameChanged"/>
151103
public string platformUserAccountName => s_GlobalState.allUserData[index].platformUserAccountName;
152-
153-
/// <summary>
154-
/// Platform-specific user ID that is valid across sessions even if the <see cref="platformUserAccountName"/> of
155-
/// the user changes.
156-
/// </summary>
157-
/// <remarks>
158-
/// This is only valid if <see cref="platformUserAccountHandle"/> is not null.
159-
///
160-
/// Use this to, for example, associate application settings with the user. For display in UIs, use
161-
/// <see cref="platformUserAccountName"/> instead.
162-
/// </remarks>
163-
/// <seealso cref="platformUserAccountHandle"/>
164-
/// <seealso cref="platformUserAccountName"/>
165-
/// <seealso cref="InputUserChange.AccountChanged"/>
166104
public string platformUserAccountId => s_GlobalState.allUserData[index].platformUserAccountId;
167105

168106
////REVIEW: Does it make sense to track used devices separately from paired devices?
@@ -853,64 +791,6 @@ public static InputUser CreateUserWithoutPairedDevices()
853791
/// user has a control scheme that is currently activated (<see cref="controlScheme"/>), then <see cref="controlSchemeMatch"/>
854792
/// will also automatically update to reflect the matching of devices to the control scheme's device requirements.
855793
///
856-
/// If the given device is associated with a user account at the platform level (queried through
857-
/// <see cref="QueryPairedUserAccountCommand"/>), the user's platform account details (<see cref="platformUserAccountHandle"/>,
858-
/// <see cref="platformUserAccountName"/>, and <see cref="platformUserAccountId"/>) are updated accordingly. In this case,
859-
/// <see cref="InputUserChange.AccountChanged"/> or <see cref="InputUserChange.AccountNameChanged"/> may be signalled.
860-
/// through <see cref="onChange"/>.
861-
///
862-
/// If the given device is not associated with a user account at the platform level, but it does
863-
/// respond to <see cref="InitiateUserAccountPairingCommand"/>, then the device is NOT immediately paired
864-
/// to the user. Instead, pairing is deferred to until after an account selection has been made by the user.
865-
/// In this case, <see cref="InputUserChange.AccountSelectionInProgress"/> will be signalled through <see cref="onChange"/>
866-
/// and <see cref="InputUserChange.AccountChanged"/> will be signalled once the user has selected an account or
867-
/// <see cref="InputUserChange.AccountSelectionCanceled"/> will be signalled if the user cancels account
868-
/// selection. The device will be paired to the user once account selection is complete.
869-
///
870-
/// This behavior is most useful on Xbox and Switch to require the user to choose which account to play with. Note that
871-
/// if the device is already associated with a user account, account selection will not be initiated. However,
872-
/// it can be explicitly forced to be performed by using <see
873-
/// cref="InputUserPairingOptions.ForcePlatformUserAccountSelection"/>. This is useful,
874-
/// for example, to allow the user to explicitly switch accounts.
875-
///
876-
/// On Xbox and Switch, to permit playing even on devices that do not currently have an associated user account,
877-
/// use <see cref="InputUserPairingOptions.ForceNoPlatformUserAccountSelection"/>.
878-
///
879-
/// On PS4, devices will always have associated user accounts meaning that the returned InputUser will always
880-
/// have updated platform account details.
881-
///
882-
/// Note that user account queries and initiating account selection can be intercepted by the application. For
883-
/// example, on Switch where user account pairing is not stored at the platform level, one can, for example, both
884-
/// implement custom pairing logic as well as a custom account selection UI by intercepting <see cref="QueryPairedUserAccountCommand"/>
885-
/// and <seealso cref="InitiateUserAccountPairingCommand"/>.
886-
///
887-
/// <example>
888-
/// <code>
889-
/// InputSystem.onDeviceCommand +=
890-
/// (device, commandPtr, runtime) =>
891-
/// {
892-
/// // Dealing with InputDeviceCommands requires handling raw pointers.
893-
/// unsafe
894-
/// {
895-
/// // We're only looking for QueryPairedUserAccountCommand and InitiateUserAccountPairingCommand here.
896-
/// if (commandPtr->type != QueryPairedUserAccountCommand.Type &amp;&amp; commandPtr->type != InitiateUserAccountPairingCommand)
897-
/// return null; // Command not handled.
898-
///
899-
/// // Check if device is the one your interested in. As an example, we look for Switch gamepads
900-
/// // here.
901-
/// if (!(device is Npad))
902-
/// return null; // Command not handled.
903-
///
904-
/// // If it's a QueryPairedUserAccountCommand, see if we have a user ID to use with the Npad
905-
/// // based on last time the application ran.
906-
/// if (commandPtr->type == QueryPairedUserAccountCommand.Type)
907-
/// {
908-
/// ////TODO
909-
/// }
910-
/// };
911-
/// </code>
912-
/// </example>
913-
/// </remarks>
914794
/// <example>
915795
/// <code>
916796
/// // Pair device to new user.
@@ -920,6 +800,7 @@ public static InputUser CreateUserWithoutPairedDevices()
920800
/// InputUser.PerformPairingWithDevice(wand2, user: user);
921801
/// </code>
922802
/// </example>
803+
/// </remarks>
923804
/// <seealso cref="pairedDevices"/>
924805
/// <seealso cref="UnpairDevice"/>
925806
/// <seealso cref="UnpairDevices"/>
@@ -1481,21 +1362,7 @@ private static long UpdatePlatformUserAccount(int userIndex, InputDevice device)
14811362
return queryResult;
14821363
}
14831364

1484-
/// <summary>
1485-
/// If the given device is paired to a user account at the platform level, return the platform user
1486-
/// account details.
1487-
/// </summary>
1488-
/// <param name="device">Any input device.</param>
1489-
/// <param name="platformAccountHandle">Receives the platform user account handle or null.</param>
1490-
/// <param name="platformAccountName">Receives the platform user account name or null.</param>
1491-
/// <param name="platformAccountId">Receives the platform user account ID or null.</param>
1492-
/// <returns>True if the device is paired to a user account, false otherwise.</returns>
1493-
/// <remarks>
1494-
/// Sends <see cref="QueryPairedUserAccountCommand"/> to the device.
1495-
/// </remarks>
1496-
/// <seealso cref="QueryPairedUserAccountCommand.handle"/>
1497-
/// <seealso cref="QueryPairedUserAccountCommand.name"/>
1498-
/// <seealso cref="QueryPairedUserAccountCommand.id"/>
1365+
////TODO: bring documentation for these back when user management is implemented on Xbox and PS
14991366
private static long QueryPairedPlatformUserAccount(InputDevice device,
15001367
out InputUserAccountHandle? platformAccountHandle, out string platformAccountName, out string platformAccountId)
15011368
{

Packages/com.unity.inputsystem/InputSystem/Plugins/Users/InputUserChange.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -73,51 +73,11 @@ public enum InputUserChange
7373
/// <seealso cref="InputUser.lostDevices"/>
7474
DeviceRegained,
7575

76-
/// <summary>
77-
/// A user has either switched accounts at the platform level.
78-
/// </summary>
79-
/// <remarks>
80-
/// This means that the user is now playing with a different user account. This is relevant for persisting
81-
/// settings as well as for features such as achievements.
82-
///
83-
/// This is detected via <see cref="DeviceConfigurationEvent"/>s. If a device is currently paired to a user
84-
/// but then notifies that its configuration has changed and the platform user we have on record for the
85-
/// device is no longer the same, this notification is sent after the platform user data (<see cref="InputUser.platformUserAccountHandle"/>
86-
/// and related APIs) has been updated.
87-
///
88-
/// In response, the application may want to update the user name displayed in the UI. When displaying user
89-
/// profile images, an updated image should also be requested from the platform APIs using the user account
90-
/// information obtained from <see cref="InputUser"/>.
91-
///
92-
/// Note that the notification may also mean that the device is no longer associated with a user account.
93-
/// In that case <see cref="InputUser.platformUserAccountHandle"/> will be invalid.
94-
/// </remarks>
95-
/// <seealso cref="InputUser.platformUserAccountHandle"/>
96-
/// <seealso cref="InputUser.platformUserAccountName"/>
97-
/// <seealso cref="InputUser.platformUserAccountId"/>
76+
////TODO: bring documentation for these back when user management is implemented on Xbox and PS
9877
AccountChanged,
99-
10078
AccountNameChanged,
101-
102-
/// <summary>
103-
/// The user was asked to select an account during the device pairing process.
104-
/// </summary>
105-
/// <remarks>
106-
/// In most cases, it makes sense to pause the game while account picking is in progress.
107-
/// </remarks>
10879
AccountSelectionInProgress,
109-
110-
/// <summary>
111-
/// The user canceled the account selection process that was initiated.
112-
/// </summary>
11380
AccountSelectionCanceled,
114-
115-
/// <summary>
116-
/// The user completed the account selection process.
117-
/// </summary>
118-
/// <remarks>
119-
/// Like <see cref="AccountChanged"/>, this means that the account details may have changed.
120-
/// </remarks>
12181
AccountSelectionComplete,
12282

12383
////REVIEW: send notifications about the matching status of the control scheme? maybe ControlSchemeActivated, ControlSchemeDeactivated,

0 commit comments

Comments
 (0)