How to set the parameter of the promoted input in XCode

Oscar de la Hera Gomez
Three flowers that represent SwiftUI, RealityKit and XCode side by side. Beneath them sits the text "Adjust Promoted Input Parameter".

To set the parameter of the promoted input of a custom shader material in XCode, gather the ShaderGraphMaterial from the entity & use setParameter(name:value:).

For more information on promoted inputs and using them in XCode, please consult the WWDC sessions and articles linked below.

The code for the example illustrated below can be found on the tutorials/reality-composer-pro/bread-shader branch of our open source VisionOS starter project.

A screenshot of Reality Composer Pro showing the scene that we are working with.

The code illustrated below is in reference of the scene above.

As demonstrated, you must:

  • Use a RealityView
  • Add the scene programatically.
  • Gather the relevant model (i.e. brioche).
  • Gather its model component.
  • Gather its ShaderGraphMaterial
  • Adjust the parameter.
A screenshot of the code that we used to adjust the promoted input.

Looking to learn more about Augmented Reality, Design and Technology?

Search our blog to learn more about A/R, design and technology.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details