---
title: "init(goal:weight:)"
framework: gameplaykit
role: symbol
role_heading: Initializer
path: "gameplaykit/gkbehavior/init(goal:weight:)"
---

# init(goal:weight:)

Creates a behavior with a single goal.

## Declaration

```swift
convenience init(goal: GKGoal, weight: Float)
```

## Parameters

- `goal`: A goal object.
- `weight`: A weight to be applied to the goal’s influence on an agent’s speed and direction.

## Return Value

Return Value A new behavior object. To assign a set of goals to an agent, use its behavior property.

## Discussion

Discussion For more information, see GameplayKit Programming Guide.

## See Also

### Creating a Behavior

- [init(goals:)](gameplaykit/gkbehavior/init(goals:).md)
- [init(goals:andWeights:)](gameplaykit/gkbehavior/init(goals:andweights:).md)
- [init(weightedGoals:)](gameplaykit/gkbehavior/init(weightedgoals:).md)
