Set Static Mesh material problem

Hello

I have a static mesh component and I am changing its material of the static mesh in realtime by using the node “Set Material by Name”. Later in the game the static Mesh from the static mesh component gets replaced with the node “Set static Mesh”, unfortunately, the materials are not getting reset, so the material slot with the same name has still the changed material applied, and not the original. So I need a way to somehow reset the material back to the original after I have replaced the static mesh component with the new one.

I was unable to change the material slot order in the ue4 neither in maya.

My current solution is to remove the component completely and attaching a new one. The other way feels cleaner. Do you have an idea to avoid, that the material changes are persistent after I have set a new static mesh or a way to reset to original materials?
Thank you.

Bump…

.

Bump…

.

Just save the original material before applying the new material. Then it’s just a question of applying the saved material to the new mesh.

Example: