<!--
{
  "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(goals:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKBehavior(cm)behaviorWithGoals:"
  },
  "title" : "init(goals:)"
}
-->

# init(goals:)

Creates a behavior with the specified goals.

```
convenience init(goals: [GKGoal])
```

## Parameters

`goals`

An array of goal objects.

## Return Value

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

## Discussion

The new behavior contains the specified goals, each with a weight of `1.0`. To change a goal’s weight after creating the behavior, keep a reference to that goal and use the [`setWeight(_:for:)`](/documentation/GameplayKit/GKBehavior/setWeight(_:for:)) method.

---

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)