Contents

playerIndex

The player index for the controller.

Declaration

var playerIndex: GCControllerPlayerIndex { get set }

Mentioned in

Discussion

Use the player index to identify which player is using the controller. Set the player index when the controller first connects to the device and you configure your game.

When you set the player index, the matching LED on the controller for that player lights up. You don’t need to provide a unique player index for each active game controller. For example, players on the same team can share a common player index. If your game no longer uses a controller, set the controller’s index value to GCControllerPlayerIndex.indexUnset.

The default value for this property is GCControllerPlayerIndex.indexUnset.

See Also

Identifying controllers and displaying a player index