<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKUniform/init(name:texture:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKUniform(im)initWithName:texture:"
  },
  "title" : "init(name:texture:)"
}
-->

# init(name:texture:)

Initializes a new uniform object that holds a reference to a texture.

```
init(name: String, texture: SKTexture?)
```

## Parameters

`name`

The name used to identify the uniform variable; you use this name inside your shader to read the uniform variable’s value.

`texture`

The initial texture to use for the uniform variable.

## Return Value

An initialized uniform object whose type is set to [`SKUniformType.texture`](/documentation/SpriteKit/SKUniformType/texture).

---

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)