Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: remove the misleading params parameter #1839

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,8 @@ public void PassivateInput()
/// </remarks>
/// <seealso cref="currentControlScheme"/>
/// <seealso cref="InputActionAsset.controlSchemes"/>
public bool SwitchCurrentControlScheme(params InputDevice[] devices)
public bool SwitchCurrentControlScheme(InputDevice[] devices)
{
if (devices == null)
throw new ArgumentNullException(nameof(devices));
if (actions == null)
throw new InvalidOperationException(
"Must set actions on PlayerInput in order to be able to switch control schemes");
Expand Down Expand Up @@ -949,12 +947,10 @@ public bool SwitchCurrentControlScheme(params InputDevice[] devices)
/// </remarks>
/// <seealso cref="InputActionAsset.controlSchemes"/>
/// <seealso cref="currentControlScheme"/>
public void SwitchCurrentControlScheme(string controlScheme, params InputDevice[] devices)
public void SwitchCurrentControlScheme(string controlScheme, InputDevice[] devices)
{
if (string.IsNullOrEmpty(controlScheme))
throw new ArgumentNullException(nameof(controlScheme));
if (devices == null)
throw new ArgumentNullException(nameof(devices));

user.FindControlScheme(controlScheme, out InputControlScheme scheme); // throws if not found
SwitchControlSchemeInternal(ref scheme, devices);
Expand Down Expand Up @@ -1939,10 +1935,8 @@ private void OnDeviceChange(InputDevice device, InputDeviceChange change)
}
}

private void SwitchControlSchemeInternal(ref InputControlScheme controlScheme, params InputDevice[] devices)
private void SwitchControlSchemeInternal(ref InputControlScheme controlScheme, InputDevice[] devices)
{
Debug.Assert(devices != null);

// Note that we are doing two somwhat uncorrelated actions here:
// - Switching control scheme
// - Explicitly pairing with given devices regardless if making sense with respect to control scheme
Expand Down