---
title: "addUniform(_:)"
framework: spritekit
role: symbol
role_heading: Instance Method
path: "spritekit/skshader/adduniform(_:)"
---

# addUniform(_:)

Adds a uniform to the shader.

## Declaration

```swift
func addUniform(_ uniform: SKUniform)
```

## Parameters

- `uniform`: The new uniform object to add. The uniform object’s name must not already be in use by another uniform attached to the shader.

## Discussion

Discussion The uniform variable is automatically accessible inside your shader; do not add a declaration for it in your shader’s source code. The uniform must be accessed in the fragment shader.

## See Also

### Providing Uniform Data to a Shader

- [removeUniformNamed(_:)](spritekit/skshader/removeuniformnamed(_:).md)
- [uniforms](spritekit/skshader/uniforms.md)
- [uniformNamed(_:)](spritekit/skshader/uniformnamed(_:).md)
