<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ComputeGraphComponent/setTexture(_:port:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit",
      "ComputeGraph",
      "_RealityKit_ComputeGraph"
    ],
    "preciseIdentifier" : "s:24_RealityKit_ComputeGraph0cD9ComponentV10setTexture_4portSbSo10MTLTexture_pSg_0cD00c4NodeD0V4PortO7AddressVtF"
  },
  "title" : "setTexture(_:port:)"
}
-->

# setTexture(_:port:)

Binds a Metal texture to a parameter identified by its port address.

```
@discardableResult mutating func setTexture(_ texture: (any MTLTexture)?, port: ComputeNodeGraph.Port.Address) -> Bool
```

## Parameters

`texture`

The `MTLTexture` to bind, or `nil` to unbind the current texture.

`port`

The port address identifying the texture parameter.

## Return Value

`true` if the port was found and the texture was set; `false` otherwise.

---

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)