How to get parent material from dynamic material instance if parent is material instance?

Took me a while to figure this out, and couldn’t find any answers. So here’s the problem i had:

Wanted to save what material the player has selected by doing a “get material” on a static mesh, and plug that material into a “get base material”.
This works but only if the material was a normal material.
If the material was a material instance it always got the parent of the material instance instead of the material instance itself.
The solution was a “cast to material instance dynamic” and from that a “get parent”.

Good luck to anyone finding this.

4 Likes

Answer is in the opening post

Life saver!!