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

# init(weightedGoals:)

Creates a behavior with the specified mapping of goals to their weights.

## Declaration

```swift
convenience init(weightedGoals: [GKGoal : NSNumber])
```

## Parameters

- `weightedGoals`: A dictionary whose keys are goal objects, where each value is the weight to be applied to the corresponding 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.

## See Also

### Creating a Behavior

- [init(goal:weight:)](gameplaykit/gkbehavior/init(goal:weight:).md)
- [init(goals:)](gameplaykit/gkbehavior/init(goals:).md)
- [init(goals:andWeights:)](gameplaykit/gkbehavior/init(goals:andweights:).md)
