I have used create dynamic material instance to distribute some actors with different colors.
and that was ok. but when I’m trying to collect the materials in the scene it return one material.
so I can’t track these actors material parameter values or collect then like I can collect their locations. so how can I collect material data from objects in the scene?
It is possible to find out what material is applied to meshes using a line trace, but that’s a really long way around.
It’s much easier to keep an array of what you’ve done ( spawning / coloring etc ), then you just know which is which.
It would look like this:
Things get more complicated if the mesh has more material slots. How to approach it correctly would depend on the collection method you have in mind and the scope.
But since you have access to the location, you must have access to the actor. From here you get its components by class and:
I have used create dynamic material instance to distribute some actors with different colors.
Generally speaking, when you apply DMI, you store its reference - at this point retrieving parameters is trivial since you do not even need the access to the components that have it assigned.