---
title: "subscript(_:)"
framework: gameplaykit
role: symbol
role_heading: Instance Subscript
path: "gameplaykit/gkcompositebehavior/subscript(_:)-6krdg"
---

# subscript(_:)

Returns the individual behavior at the specified index in the composite behavior’s list of behaviors.

## Declaration

```swift
subscript(idx: Int) -> GKBehavior { get }
```

## Parameters

- `idx`: An index in the composite behavior’s list of individual behaviors; it must be less than the value of the doc://com.apple.gameplaykit/documentation/GameplayKit/GKCompositeBehavior/behaviorCount property.

## Return Value

Return Value The behavior at the specified index.

## Discussion

Discussion The order of individual behaviors in a composite behavior is undefined. However, you can use this method to enumerate all individual behaviors in a composite behavior.

## See Also

### Working with Behaviors Using Subscript Syntax

- [subscript(_:)](gameplaykit/gkcompositebehavior/subscript(_:)-6jng9.md)
