Download

UMG buttons change material to world grid material

Hi, as the subject states for some reason the UMG button I’m using to change materials on a mesh doesn’t change it to the specified material, it just reverts back to the default world grid material.
Here’s a snip of the BP:

As you can see from the image

i have a choice of four materials that will get applied to a whole selection of meshes. When i press the UMG button it makes a bool true which controls which material is supposed to be applied. But instead of changing to chosen material it get set to the world grid material like so:
WGMat.PNG

Does any one have any ideas as to why this is happening?

Thanks!

Hello,
I suppose trouble comes from your sequence. If you link false output to next input branch instead, (and remove sequence) it would work.

If on click, you set a variable component with the component clicked, you’ll then can use this variable to set your material instead of having to do a hundred of wires and possible mistakes too.

Edit : Instead of 4 bools, you can use an integer too, and use a switch to set material.

Hi sorry its taken me a while to get back I’ve been away!

I’ve removed the sequence and linked the false nodes to the input of the next branch but i still get the same out come.

Is there a specific way of setting up the materials? At the moment its just textures plugged in to the diffuse input.

Thanks!

I did a first try. In this set up, first i select mesh in level (i added render custom depth to see which mesh is selected) then i select material in widget from an array with type material. As an example, i loop the actors. As in your system you have the mesh, set it in a variable on click and replace the get all actors by this variable.