<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKDecisionTree/init(attribute:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKDecisionTree(im)initWithAttribute:"
  },
  "title" : "init(attribute:)"
}
-->

# init(attribute:)

Creates a decision tree starting with the specified initial attribute to test.

```
init(attribute: any NSObjectProtocol)
```

## Parameters

`attribute`

The first attribute to test (or question to answer) when evaluating the tree.

## Return Value

A new decision tree.

## Discussion

The decision tree returned by this initializer is incomplete. To build a manually defined tree, use the [`rootNode`](/documentation/GameplayKit/GKDecisionTree/rootNode) property to access the node corresponding to the initial attribute, and use [`GKDecisionNode`](/documentation/GameplayKit/GKDecisionNode) methods on that object to create branches leading to child nodes that represent additional attributes to test or final actions.

---

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)