<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/CustomMaterial/withMutableUniforms(ofType:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14CustomMaterialV19withMutableUniforms6ofType_yxm_yxz_AC15ResourceStorageVy_xGztXEtlF"
  },
  "title" : "withMutableUniforms(ofType:_:)"
}
-->

# withMutableUniforms(ofType:_:)

Calls the given closure with an inout reference to the underlying storage bound to the
custom uniforms argument of a surface shader and geometry modifier.

```
mutating func withMutableUniforms<UniformsType>(ofType: UniformsType.Type, _ callback: (inout UniformsType, inout CustomMaterial.ResourceStorage<UniformsType>) -> Void)
```

## Discussion

This method operates like [`withMutableUniforms(ofType:stage:_:)`](/documentation/RealityKit/CustomMaterial/withMutableUniforms(ofType:stage:_:))
but sets the same value for all stages at once.

When using this form, ensure that the custom uniforms arguments passed to each stage of your
CustomMaterial are of the same 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)