How to change single material color of GameObject?

Hello! I need to change color of object’s child color. So, this child has 3 materials, i need to change only one material’s color. [171319-скриншот-20-11-2020-134708.png|171319]
On this image you can see whole the object. In it has child “default” with 3 materials. I need to change Blue to red in script. I tried to make this using:

ramps[stageCount].transform.GetChild(0).GetComponent<Renderer>().material.SetColor("_Color", Color.red);

But this script changes White color:[171320-скриншот-20-11-2020-135557.png|171320] How to get “Материал.2”?

You are going to have to access the material array materials. Iterate through them to find the one you want and then change the color:

Material[] mats = ramps[stageCount].transform.GetChild(0).GetComponent<Renderer>().materials;

for( int i = 0; i < mats.length; i++ )
{
    //material name usually returns something like "material_name (Instance) so you you can use Contains like I did or use another way to identify it. Contains might not work if the other materials names contain the substring that you pass, but if you name them so they don't have this problem, you should be fine"
    if( mats*.name.Contains("material_name") )*

{
mats*.SetColor( "Color", Color.red );
break;
_
}*

}