Do something for each material in each renderer in children...

I have a car mesh with separate parts but with same material…
I’m trying to change color of all materials called “carMaterial” in all renderers in the child objects of the car object…

I have tried different approaches but with no luck…

CarBodyRenderers= GetComponentsInChildren<Renderer>();
    	foreach(Renderer rend in CarBodyRenderers){
    			foreach(Material matt in rend.materials){
        if( == "carMaterial"){
            etColor("_Color", carPaint);

Found my answer here:

The correct syntax for this is:

if( == "carMaterial (Instance)")

Grab the sharedMaterial instead of all materials of at least one object using it and modify the color. It should automatically change all of them.

Also comparing a materials name with a string actually checks against the GameObjects name (Material, Object name definition)