Have blueprint execute on multiple objects?

I have an environment which has many static mesh components.

I want to be able to change the material on a key press.

I have successfully created a blueprint for one of the objects to change the material when a key (0) is pressed and it works great. However, I’m struggling to get it so I can run it on all of the objects I want to.

I thought I could select all of the objects and create a static mesh and then create a blueprint for that, iterating over each object in the mesh, but I can’t create a static mesh of the objects.

I’m very new to using unreal, any help is appreciated.

Update: I was able to get objects into the same blueprint… but looping over them isn’t working.

My blueprint is attached

I noticed the material you are setting is different between your examples. Was that intentional?

I was gonna recommend what you just did haha So what is the issue with the loop not working? Do you have multiple materials on the objects because that loop as it currently stands will only change the first material at index 0 on each object. What specifically are you trying to do?

I want to be able to press a key (eventually one of a few) and change the material on several objects (to the same material).

There is only one material on each object ( I think).

With the set up above, none of the material change. If I do the same thing with the original blueprint the material changes, in fact I can set up a few different key press events and have a different material selected for each, and the material on the object changes as expected.

It’s when I try to do it in a loop for several object that nothing is changing.

I tried casting each object to a static mesh actor after the for loop and passing that to set material, but static mesh actor doesn’t inherit from static mesh component.

yeah, the bricks is easier to see that it changes.

Well… not sure what was going on… but it’s working now… thanks

Thanks, you solved my problem~