Changing MaterialInstance parameters from Widget Blueprint

Hello guys, I’m building a fighting game (Street Fighter, Tekken, etc alike), but fairly new with Unreal.
After I developed some basics of my game, I wanted to customize my BattleHUD a bit, so I thought of adding a wavy effect to my HP bars. I made a Material and 2 MaterialInstances out of it, one for each side the bar will be facing.

Left bar example: (the right bar has the wave effect in the other side)

I’m having a problem right now, and it’s that I can’t change the parameters that control the percentage of that wavy bar, everytime hp decreases the wave effect stays in the same position, so I should change a scalar parameter I have in my Instances (called Percentage) so the wavy effects moves too. I can’t change this parameters and I have tried couple of stuff.

Feel free to ask for code pics or whatever.
Thanks in advance.

It’s generally done via this:

https://docs.unrealengine.com/en-US/…lue/index.html

Mismatching parameter names perhaps? Or the scalar operates in the wrong range: 0-1 rather than 0-100. Consider posting a screenshot of how you set it in case this does not help.

Hi Everynone,

here’s a screenshot of one of my MaterialInstances:

and some others of the logic I implemented to try changing that Percentage from my Widget Blueprint:

​​​​​​​Screenshot - 8ae0d826402f877136563e5e51327c27 - Gyazo

In none of the screenshot can we see you adjust the scalar value of the material instance to be honest - it’s a very strange method and the Set Brush Resource to Material diamond by-reference pin is not connected. Also, consider looking into Set Members In Struct node - there’s generally less wires and less room for error:

setmem.png

But to the point, it’s all much simpler than that:

Create it inside the widget and assign to the element that needs it. Make sure the material operates in the UI domain, of course. There’s no need to fiddle with the brushes.

edit: Here’s a spot on example:

Hello man, thanks for your help, I was researching all day yesterday and found out I had to create, as you mentioned, a Dynamic Instance of the material to be able to change the parameters inside the said Instance. I was working only with MaterialInstance instead the Dynamic one, so I wasn’t able to control them. I managed to solve it using what’s in the second screenshot you attached.

Thanks so much for your help!