Multiple target references in blueprint?

Hey All,

Sorry im not much of a programmer and not great with blueprints, apologies if this is a very obvious question.

Basically i have a scene where i need to switch all the materials at once and cycle through many different options, i know how to do this BUT at the moment there are many many objects that need to switch at once, and I’m having to select every single one in the scene, reference it, plug it into the node individually and its killing me, its taking SO long to do, here is a pic:

That doesn’t look right. Its literally just a referenced actor from the scene plugged into a set material node. There must be a more efficient way of doing this? I don’t really want to use a blueprint actor as i have my scene already set up, and i don’t want to replace everything again, that would also take forever. I also have a similar problem with referencing for timelines etc. Is there a way to reference multiple things at once or something?

PLZ help, this is driving me insane. Thx

There are a few ways to do this.

You could get GetAllActors of class and put all of the actors in an array. Then foreach member of the array, assign the desired material.

However, GetAllActors is not cheap. If possible, you could have the game mode or some other actor keep track of the actors instead. This can be done several ways depending on the type of game you’re making and how these actors are spawned/placed in the world.

Alternatively, if at all possible, rather than assigning materials over and over, consider setting up the materials so that you only need to change parameters. If you combine using Dynamic Material Instances and Material Parameter Collections, you’ll be able to change all materials from one place and only once (well, for each time you want them to change).

These videos might help:

https://www.youtube.com/watch?v=i4Z2r7mGA0o

Hey Afelius! Thanks for the help, that has absolutely given me somethings to work out, but a step in the right direction for sure. A quick question about dynamic materials, can you switch out texture maps, like normals, diffuse, AO etc? otherwise i dont think i could use that method.

Hey again, it seems as though with the dynamic material method i still have to either create a blueprint actor or reference every object the material is present on, which kinda make the issue arise again, does anybody know if there is a way to reference the dynamic material in the blueprint without referencing every object it sits on?