UMG Buttons to Set Materials on a Mesh?

I have a simple blockout shape of a water fountain object made into a blueprint. In its blueprint, I went in the graph and created an event so that when I click on the base, it calls up a widget I created. The widget is a basic menu that has 3 buttons. I attempted to add an “on clicked” event for the first button, so that when it’s clicked, it changes the material of the base to something else. I added the “fountain” in the UMG graph by creating a object reference variable to point to the fountain object. However, it doesn’t seem to do anything when I test it out, and I received no errors. The blueprint setup for the material swap/change works if I put it on the level blueprint and I click on the fountain base mesh itself to change it though. Is it possible to achieve this same effect but through clicking a button from a UMG menu, having it apply the material then?

I attached some images of my setup.


First I would try and debug to see what is firing and what is not… is the OnClicked event for the material button executing? If so then I would guess that the reference variable is set up wrong somehow (maybe check if it is null?).

Yeah, the OnClicked event is firing and executing properly. I agree and think there’s a problem somewhere in the reference variable that I’m missing or doing wrong.