<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameController",
  "identifier" : "/documentation/GameController/GCController/playerIndex",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Game Controller"
    ],
    "preciseIdentifier" : "c:objc(cs)GCController(py)playerIndex"
  },
  "title" : "playerIndex"
}
-->

# playerIndex

The player index for the controller.

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

## 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`](/documentation/GameController/GCControllerPlayerIndex/indexUnset).

The default value for this property is [`GCControllerPlayerIndex.indexUnset`](/documentation/GameController/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 ``doc://com.apple.gamecontroller/documentation/GameController/GCControllerPlayerIndex/indexUnset``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)