Can't change material color

Hello, I’m trying to change color of static mesh actor when specific event fires. I have something like this but color isn’t changed for unknow reasons:

any ideas what I’m doing wrong?

There’s a bunch of issues with that script:

  1. You do not need to [Cast][1] (you even have a blue note on the cast node)
  2. You are assigning the same dynamic material twice

This does the same as your code above:

Also, do you need to use GetAllActorsOfClass?

It might be failing for 5 reasons:

  • there is no material assigned to the original static mesh component (so there’s nothing to create the dynamic material out of)
  • there is a dynamic material assigned already and you cannot make a dynamic material out of another dynamic material (unless something changed in 4.17-4.18) ([see here][3])
  • the name of the parameter Color is incorrect - they are case sensitive, too as far as I remember. Make sure it’s identical in the Source Material
  • the plugin you’re using is not working correctly (unlikely as this is Rama’s stuff, right?) - just in case, try to PrintString the colour you’re sending to the parameter as a test
  • the actor you’re trying to Get is constructed after the actor that we see in the screenshot - check if you’re fetching a valid object out of GetAllActorsOfClass

Try feeding the CreateDynamicMaterialInstance node a Source Material from the dropdown and see if it works.

So the problem was that I wasn’t passing parameter name correctly. It needed to be DiffuseColor. Thanks!