Better way to deal with multiple set material nodes

So i’m making a card game. I have this actor that i set a material to based on random integers as my card, this is my setup.

I’m wondering if there is a better way to do this? I think it looks quite messy and i’m about to add a lot more cards.

Ether use functions or macros to mask messiness

Functions / macros would work great like mentioned, especially if you will need to do it multiple times in different places, or you could also do something like this:

Use a dynamic material (so you have only 1 base material and many instances) and a parameter, like I described in your other thread.

Especially if the materials are similar, which seems to be the case here.