Download

Button To Change Object Material

I am trying to simply create a Button on the UI that changes a material’s color. I have everything working except when I click the UI button, the Material does not change on the object. Using HUD Widget. Any suggestions? Details in the image:

Any advice is appreciated. Please let me know if you need more information!

What is the floor object? It does not look like a ordinary actor, that icon looks more like instanced mesh or something. Correct me if wrong, but instanced meshes cant change material during runtime due to rendering optimizations?

My floor started as a static mesh with a material applied. Then I selected it and converted it to a Blueprint. So its basically a blueprint with the floor as a static mesh (inherented). I can take a screenshot of my BP_Floor if you’d like?

Nope sorry, I have totally lost it now. I must have left my brains at home or something, because for the world I cant figure out right now how to communicate between widget and mesh bp directly. I really thought this was much simpler. :frowning:

So you are experiencing the same issue I have encountered?

Ok, I have made some progress. Tested adding a “Set Material” connected to the “Event BeginPlay” in my character’s BP, I created a variable just like I did in my Widget that links to my floor. Made this variable “Editable” so now when I select my Character in the viewport, I was able to add the “Floor” instance into this variable from the “Details” list. This made it work when I launched my game.

SO… It appears the only thing stopping me is the ability to add my “Floor” instance to the public variable in my HUD Widget. Does anyone know how to access Widget Details from the viewport Details panel? Or am I going about this all wrong?

Ok, I think I have found a BUG. Or I am missing something. Someone please enlighten me! Details in the screenshots:

c6577e8944ecc400c50ecc975696b40ed8c924bd.jpeg

c345d0ece0f8e62727acfa25dd00d56c50f4af81.jpeg

10228795b109438c8c1f028fa89192177a9425ff.jpeg

How are you referencing the floor object? How does the HUD know what object it’s dealing with?

This is how the floor object is being referenced inside the HUD Widget:

a477b86d018ec8129257d88dca75c9e215c67de8.jpeg

Does anyone have a solution to this? Is this a bug or am I doing something wrong? I still have not solved it. Any support would be appreciated.