---
title: "childNode(withName:recursively:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnnode/childnode(withname:recursively:)"
---

# childNode(withName:recursively:)

Returns the first node in the node’s child node subtree with the specified name.

## Declaration

```swift
func childNode(withName name: String, recursively: Bool) -> SCNNode?
```

## Parameters

- `name`: The name of the node to search for.
- `recursively`: doc://com.apple.documentation/documentation/Swift/true to search the entire child node subtree, or doc://com.apple.documentation/documentation/Swift/false to search only the node’s immediate children.

## Discussion

Discussion If the recursive parameter is true, SceneKit uses a preorder traversal to search the child node subtree—that is, the block searches a node before it searches each of the node’s children, and it searches all children of a node before searching any of that node’s sibling nodes. Otherwise, SceneKit searches only those nodes in the node’s childNodes array.

## See Also

### Searching the Node Hierarchy

- [childNodes(passingTest:)](scenekit/scnnode/childnodes(passingtest:).md)
- [enumerateChildNodes(_:)](scenekit/scnnode/enumeratechildnodes(_:).md)
- [enumerateHierarchy(_:)](scenekit/scnnode/enumeratehierarchy(_:).md)
