Skip to content

IInputPlayers

Source: Assets/UpscaleSDK/Core/Input/Runtime/Provider/Abstractions/IInputPlayers.cs

interface IInputPlayers

Defines the contract for the local players of an input provider: which gamepad drives which player, joining, and gamepad loss.

Events

event Action<int> OnPlayerJoined

Occurs when a player joins (a new player index becomes active).

event Action<int> OnPlayerLeft

Occurs when a player is removed.

event Action<int> OnPlayerGamepadLost

Occurs when a player's gamepad disconnects; the player waits for a gamepad.

event Action<int> OnPlayerGamepadRegained

Occurs when a waiting player has a gamepad again (its own reconnected, or another one was given to it).

Properties

int MaxPlayers

Gets the number of local players the game allows at once.

bool IsMultiplayer

Gets whether more than one player is allowed. False: any gamepad drives player 0 and no player tracking happens.

PlayerJoinRule JoinRule

Gets or sets the rule for presses on gamepads that belong to no player.

Methods

void Update()

Called once per frame before bindings are read.

bool IsPlayerActive(int player)

bool IsWaitingForGamepad(int player)

IReadOnlyList<int> GetActivePlayers()

Gets the active player indices, in ascending order.

IReadOnlyList<int> GetPlayersWaitingForGamepad()

Gets the players whose gamepad is disconnected, longest-waiting first.

bool RemovePlayer(int player)

Removes a player and frees its gamepad. Player 0 is never removed.