<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKBehavior/init(weightedGoals:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKBehavior(cm)behaviorWithWeightedGoals:"
  },
  "title" : "init(weightedGoals:)"
}
-->

# init(weightedGoals:)

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

```
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

A new behavior object. To assign a set of goals to an agent, use its [`behavior`](/documentation/GameplayKit/GKAgent/behavior) property.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)