Instance Property

playerIndex

The player index assigned to the controller.

Declaration

var playerIndex: GCControllerPlayerIndex { get set }

Discussion

The player index is a value that determines which player is associated with the controller. Whenever your game is actively using a particular game controller, you must set the player index to a proper player index. Typically, you do this when the controller is first connected and configured by your game. You are not required to provide a unique player index for each active game controller. For example, you could have all players on the same team share a common player index. If a controller is no longer in use by your game, you must set the controller’s index value to GCControllerPlayerIndex.indexUnset.

The default value is GCControllerPlayerIndex.indexUnset.

When a player index is set, the matching LED on the controller for that player lights up.

See Also