Change material instance parameter in a widget

I have a material instance placed in a UMG widget and want to change a parameter in that material from inside the widget itself.

When I scroll the mouse in or out I want to change the value in that parameter.
I am trying to scale an image “Zoom in and Out” this way.
So far i cannot correctly get a reference to any parameter in the widget material to update it

Wait so are you changing the Landscape material or the Widget material?

Oh sorry I did mean widget material. I don’t know why I wrote landscape. Thanks I fixed that

I noticed you called it a Material Instance and not a Dynamic Material Instance.
If it is a Material Instance, it cannot have its parameters changed at runtime (only as settings in instance assets you create in the editor),
but if it is a Dynamic Material Instance (or is it called Material Dynamic Instance???) then it can.

So if it’s not working to change realtime via blueprint, it could be because it’s not a Material DYNAMIC instance.

I have set the material as a Dynamic Material Instance but i cannot access the variables inside it. I however can access the variables this way if i add the material to an external static mesh. I am not sure if this feature works when I am accessing a Dynamic material instance that is applied inside a widget ?

The way I do it is in my blueprint, usually in the Construct event, I Create Material Dynamic Instance and assign it to a variable on the blueprint, then in the same blueprint, when I want to change the material parameter, I get the variable, and pull out a SetVectorParameter or SetScalarParameter or whatever kind of parameter it is.