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

# subscript(_:)

Returns the weight associated with the behavior specified by subscript syntax.

## Declaration

```swift
subscript(behavior: GKBehavior) -> NSNumber { get set }
```

## Parameters

- `behavior`: An individual behavior already included in the composite behavior’s set of behaviors.

## Return Value

Return Value The weight applied to that behavior’s influence on an agent’s speed and direction, or 0.0 if that behavior is not in the composite behavior.

## Discussion

Discussion This method is equivalent to the weight(for:) method, but allows access using subscript syntax.

## See Also

### Working with Behaviors Using Subscript Syntax

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