changing material color by pressing a key

Hello. i have created an object with a yellow color in its material. i want to press the “E” button and change its color to something else …red for example. . Please can someone guide me? i allready setup the inputs but i dont know how to access the material from blueprint… i prefer class blueprint technique. thanks in advance

Hi, from you mesh, from which you want to change a material parameter, use “Create Dynamic Material Instance” and input the material index there (so for example if you would have 2 materials on your mesh and you want to change the yellow color in the first one the index would be 0).
From the output you can use “Set Vector Parameter Value”, the Parameter Name would be the name of the parameter in the material you want to change.