How can i change material color of multiple objects inside blueprint?

I’m spawning a grid inside my level https://i.imgur.com/LrMcZo2.png

Then im creating onHit event for every static mesh created by macro. https://i.imgur.com/DswKFnm.png

Now every player have assigned different color (e.g. player1 : blue, p2: red etc.), so instead of duplicating same material over and over for X colors i want to assign base color based on player color.

As you can see in BP screenshoot i want to replace ‘set material’ with something that will allow me to change base color of material.
I know i can achieve that by using ‘set vector paremeter value’ , but i dont know how to exactly create dynamic material instance and then call onHit to change color of exact object that character just hit.

You were on the right track with Dyanmic Material Instance. If you create a dynamic material instance in the construction script with a material instance that has exposed parameters for the values you want to change.

Then you can simply change the parameter whenever you want, even lerp it if necessary.

Yes, i knew about it, but since it’s not a single mesh but grid of meshes i couldnt figure it out.
What I’ve done is upon construct every instance is added to array, then on component hit I search through array of meshes (also created in construction script) to get index, and i use this index to get exact tile from grid and set it color with vector paramter value.