How do I store original mesh materials of a static mesh in an array?

Hey everyone!

I have a system that makes use of the Layer subsystem in the level editor. So far it’s doing just about everything I want it to do.

Here is a basic overview of the system:

I select the Layer name, get all actors’ Static Mesh Component and attempt to store the original material in an array. Once the materials are stored, I then switch the material to the highlight colour (so highlight all actors in the layer). I can then toggle it again and it replaces the highlight colour with the original material of the static mesh component.

The problem I am having is storing the original mesh material. It stores it but doesn’t apply the right material back to the mesh when you turn of the highlight colour.

The link below is my current Blueprint method. I think I’m on the right path, but it would be great for some advice and tips as it gets the wrong material.

You’re not clear about what exactly is buggy. But it looks to me like you’re just storing the materials in the order they happen to arrive in.

Later on, they just come out in the same order, but the meshes may not be in the same order.

Is that the problem?

Hey thanks for the reply.

Apologies for not being clear and thanks for letting me know!

At the moment each layer only contains one type of actor with the same materials. It’s just when I get around to reapplying that original material, it replaces them with the wrong one (a material from another layer).

Here’s a video of what is happening (ignore the layer names) UE4 Layer issue - YouTube

In the ‘store materials’ network, you’ve left out the loop over the actors?