---
title: playerIndex
framework: gamecontroller
role: symbol
role_heading: Instance Property
path: gamecontroller/gccontroller/playerindex
---

# playerIndex

The player index for the controller.

## Declaration

```swift
var playerIndex: GCControllerPlayerIndex { get set }
```

## Mentioned in

Discovering game controllers

## Discussion

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. important: In iOS 13 and later, tvOS 13 and later, and macOS 10.15 and later, two apps can use the same player index. Prior to these releases, if another app uses the index, this framework sets the player index in the other app to GCControllerPlayerIndex.indexUnset.

## See Also

### Identifying controllers and displaying a player index

- [GCControllerPlayerIndex](gamecontroller/gccontrollerplayerindex.md)
