how to change the material of the object using c++ without blueprint in vr

i’m make an concept vr walkthrough,toggle light on/off and change the material of the object one or more button on present on the screen.this button like photoscrolling(right and left arrow widget(next button)) makes to change the material of an object.please help…
initially which object should changed that will glow on the screen.
please help me… quick reply… i need…

Use a material instance dynamic.
You can create one at runtime by calling ->CreateMaterialInstanceDynamic on your mesh component. The resulting material instance will be automatically set in your mesh. Then you can set the value for the parameter nodes that you put in your material graph.

not as dynamic material. i had an option to change the material like use to image button…
how to did it

I’m having a difficult time trying to understand you. So you want an editable material property on your class, right?

UPROPERTY(EditAnywhere)
UMaterialInterface* Material;

i think you see what can i told Realtime architectural walkthrough in one click - eyecad VR - YouTube

how to use widget in c++