---
title: "attribute(forKey:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnscene/attribute(forkey:)"
---

# attribute(forKey:)

Returns the scene attribute for the specified key.

## Declaration

```swift
func attribute(forKey key: String) -> Any?
```

## Parameters

- `key`: One of the constants described in doc://com.apple.scenekit/documentation/SceneKit/scene-attributes that identifies the attribute to be read.

## Return Value

Return Value The scene attribute for the specified key, or nil if no such attribute exists.

## See Also

### Managing Scene Attributes

- [setAttribute(_:forKey:)](scenekit/scnscene/setattribute(_:forkey:).md)
- [SCNScene.Attribute](scenekit/scnscene/attribute.md)
