Is there any way to crawl the color fields on a material ?

Ok right now i’m just trying to write a simple little debugging script, to cover something in random colors.

Given a model, i’d like to crawl through every material on that model, and for each material, i’d like to crawl through its color fields and set each to a randomly generated colour.

How might i do this for normal objects using the standard shader, first?

I also have some materials which are using a custom shader, with many more colour fields on it.

I’m wondering how i might also get and set those colour fields.

Elsewhere in my code, i’ve set those extra colour fields internally like:

.SetColor("_Color1", Colour0);
.SetColor("_Color2", Colour0);
.SetColor("_Color3", Colour0);
.SetColor("_Color4", Colour0);

But that was in a case where i knew i’d only be dealing with materials using my custom shader. I’m not sure how to discern if i’m using that shader or not, in order to set those custom fields.

In any case i’m wondering if there’s a “dumb” way to do it, not having to know anything about the shader in question, but just crawl through all the colour fields it has regardless

Well i’m doing some testing. It seems that there are no errors or issues if i attempt to set a color field that doesn’t exist. So for now, i’ve got it working with setting all colour fields I’m aware of, including the four above. That solves the problem at least, but i would still like an answer to my last question, re: a dumb way of crawling the fields