Material Instance Dynamic Set Texture Parameter has no effect for UMG widget image

I am trying to change a texture used in a material for a UMG image brush. I have created a Material Instance Dynamic out of that material so I have a reference to it and can change the texture at run time.

After I run the Set Texture Parameter Value call my UMG image doesn’t change. I don’t see any methods to force a material to update in any way.

I did some debugging and verified that everything is correct and not NULL. My references to material interfaces and textures and parameter names all check out. I even did a Get Texture Parameter call and can clearly see that the parameter value is correctly updated to my new value, however in game there is no change.

Is there maybe something I need to call on the UMG widget itself to force it to update?

One other thing may be that the pointer I have to the Material Instance Dynamic is different from the material being used in the widget somehow. I’m not sure how to debug pointers in Blueprint though since I don’t really see an address.

Well, It looks like the Dynamic Material Instance wasn’t being used by the image. I had to assign the dynamic material back to the brush image after getting from the brush earlier. I guess dynamic materials don’t reference the original material at all like I thought but are more like a new copy of it.

1 Like

That’s correct. MIDs are new instances of the materials. When building draw calls for the GPU it helps to not rebind shaders or parameters for a particular draw call. So if 10 items use the exact same material pointer, you can draw them one after another without binding a new shader or parameters to the GPU. Also prevents you from mutating the state of a shared material asset, that multiple meshes may be using.

The weird thing is all examples I see of using MID don’t show it being reassigned back into whatever was originally using it. It just shows you creating the MID and then changing props at runtime. Maybe the docs should be updated to also reflect that extra info.