<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/PortalMaterial/setParameter(name:value:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14PortalMaterialV12setParameter4name5valueySS_AA0D10ParametersV5ValueOtKF"
  },
  "title" : "setParameter(name:value:)"
}
-->

# setParameter(name:value:)

Sets the value of a parameter by name.

```
mutating func setParameter(name: String, value newValue: MaterialParameters.Value) throws
```

## Parameters

`name`

The name of the parameter as declared in the shader graph.

## Discussion

Call this method to drive a shader-graph input from Swift — for example,
to animate a portal’s opacity each frame, or to swap in a different
texture in response to user input.

> Throws: An error if the parameter doesn’t exist on this material’s
> program, or if the value’s type doesn’t match the parameter’s
> declared type.

---

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)