Hello all! I have 3 different types of meshes in the scene (3 chairs) with multiple instances. All of them are sharing the same material.
I want to switch material on all of them at once on button press. How can I do this? I do know how to do it with individual meshes.
First I’d like to point out that Input events shouldn’t be implemented on “outside” actors. All those should be linked to the Player, either on the player itself or its controller.
You can create a manager BP for clarity in charge of these mesh actors.
When the action is called (Input E), use GetAllActorsOfClassWithTag. Then inside the mesh actor you can have your own function or event with a parameter to tell it what material you want, and call it on a ForEachLoop from the manager taking the GetAllActorsOfClassWithTag array.
Another option is to create a Dispatcher on the manager or control BP, and on the Begin Play of your mesh actors bind to that Dispatcher being called if they have the tag you want.
this function searches for all actors that have a given tag, and all the static meshes of these actors that also have this tag, and changes the material of these static meshes to what you feed into the function
And call this function where your logic for changing material should be