---
title: "setValue(_:forAttribute:)"
framework: spritekit
role: symbol
role_heading: Instance Method
path: "spritekit/sknode/setvalue(_:forattribute:)"
---

# setValue(_:forAttribute:)

Sets an attribute value for an attached shader

## Declaration

```swift
func setValue(_ value: SKAttributeValue, forAttribute key: String)
```

## Parameters

- `value`: An attribute value object containing the scalar or vector value to set in the attached shader.
- `key`: The attribute name.

## See Also

### Setting a Node’s Unique Attributes for a Shader

- [attributeValues](spritekit/sknode/attributevalues.md)
- [value(forAttributeNamed:)](spritekit/sknode/value(forattributenamed:).md)
