Change parameter of material in level blueprint

I want to change the parameter ‘MyColor’ of material ‘ColorParam’ in Level Blueprint to a random value every time i press ‘2’.

I can do this as a Blueprint actor with a mesh (Cube) defined as the input target in the construction script, like this (the Print Sting is just for debugging):

and

I want to get rid of the mesh connection and instead change the parameter of the material itself. Is that possible in any way?

1 Like

I have the same problem!

Hello Alltvin!

In my product IwTransit, I do it this way.

This example is for changing the color, to alter other values, check the “type” that is needed in the material, and adjust as required, but the Name is absolutely required. I have not found a way to query a material, and get all the parameters it supports, and then get all the “types” that it is. Such that I could say, I want all parameters, and of those, which is the parameter for the color?

  1. I use a material inteface (Just allows more “Material types” to be used.
  2. You will need to know the name of the parameter and type, in the material you wish to alter
  3. Create a Dynamic Material Instance (that’s the name of the node as well)
  4. Using node, Set Parameter Value, Feed in
    a. Dynamic Material Instance
    b. The name of the parameter that you wish to change
    c. The value that you wish to change it too.
  5. your done, kind of

Don’t forget to set the new Material Instance to the static mesh, skeleton, whatever. For primitive components, the node is Set Material.

Hope this helps.

Hi!

This is rough example, but i think this works the way you want.

This is Construction Script in Cube actor

This is Level Blueprint.

After press “R”, BP get all actors in a scene and try to change Color parameter in material. If actor have material with Color parameter, then color will changed.

Result

59029-color.gif