How to set the parameter of the promoted input in XCode
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.
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.
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.