I want to change a mesh material with a button

Hi everyone, I’m trying to change a mesh material by clicking on a button. So I have three buttons on a HUD that are setting an index number for a material array when clicked, although it changes the material, it only shows me the default squared material. I’ve tried to plug a simple variable containing a material in the set material, but I’ve had no better results . I’m trying to make it work for mobile. it works fine with the shader model 5.So i’m beginning to think the set material is not optimised for mobile ? Here is the object’s blueprint. Every comments would be most welcome. Thank !!


Really ? I’m the only one to have that problem ?

So your blueprint is working fine but the material is not displaying correctly on mobile? It sounds like you answered your own question; the material must not be set up to work correctly on mobile. I assume you’ve read the documentation on materials for mobile? Materials for Mobile Platforms | Unreal Engine Documentation It has a small tip on troubleshooting “Default Material is displayed in the Mobile Previewer”, maybe that will help.

Hi Ross,

Thanks for that answer. I checked that topic already and it helped a lot, but for now I’m trying to assign very simple material (just a base color actually). But something new came up, I realised that the script works only when the lighting is not build and doesn’t work anymore with the lighting build, and I don’t seem to find any topic about that. Any help would be greatly welcomed.


Watch dynamic material instance tutorial.
Use dynamic materials for that, mark mesh as dynamic.
Make sure you are not applying that stuff every frame (ie. every tick)
Watch tutorial about blueprint communication.
make event dispatcher for changing materials, or for now change then on key press, like 1 for one 2 for another, to rule out that you messed some logic in blueprint code.

Hi Nawrot,

Thanks for your answer. So I’ve tried to switch to dynamic objects an the script is now working wich is great but I’m also losing my lighting, and reflections sphere don’t seem to work anymore on mobile ? I get the message : “Update reflection captures only works with an active feature level of SM4 or greater.” My lighting is based on one HDRI skylight an sky so the reflections are the most important feature to light my objects… I have to admit that i’m quite confused with that, it was working fine until now.

So, little update : it’s a mobile/html5 project and i need to display an HDR map reflections on an object wich seems to be doable only with the skylight set to static. So I have to let my object as static, wich puts me in same position as before, the script is not working with lightmapped static objects. And the dynamic material instance solution doesn’t seem to be suitable…
Any ideas ?


Did you find a solution? My entire landscape is missing on iOS.