---
title: "subscript(_:)"
framework: gameplaykit
role: symbol
role_heading: Instance Subscript
path: "gameplaykit/gkbehavior/subscript(_:)-2yvko"
---

# subscript(_:)

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

## Declaration

```swift
subscript(goal: GKGoal) -> NSNumber! { get set }
```

## Parameters

- `goal`: A goal already included in the behavior’s set of goals.

## Return Value

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

## Discussion

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

## See Also

### Working with Goals Using Subscript Syntax

- [subscript(_:)](gameplaykit/gkbehavior/subscript(_:)-997a9.md)
