<!--
{
  "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(handle:value:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14PortalMaterialV12setParameter6handle5valueyAA0D10ParametersV6HandleV_AH5ValueOtKF"
  },
  "title" : "setParameter(handle:value:)"
}
-->

# setParameter(handle:value:)

Sets the value of a parameter identified by a handle.

```
mutating func setParameter(handle: MaterialParameters.Handle, value newValue: MaterialParameters.Value) throws
```

## Parameters

`handle`

A handle previously returned by [`parameterHandle(name:)`](/documentation/RealityKit/PortalMaterial/parameterHandle(name:)).

## Discussion

Use this overload alongside [`parameterHandle(name:)`](/documentation/RealityKit/PortalMaterial/parameterHandle(name:)) when you update
the same parameter often enough that avoiding repeated name lookups
matters. For one-off updates, [`setParameter(name:value:)`](/documentation/RealityKit/PortalMaterial/setParameter(name:value:)) is more
readable.

> 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)