Set material of child that enter the collider.

Hi i need little help. This is my code:
`
Transform hex;
public Material Dirt;
public Renderer childColors;

public void Start()
{
    
}
void OnTriggerEnter(Collider other)
{
    
    
    if (other.gameObject.tag == "Grass")
    {

        
        //MeshRenderer childColors = other.GetComponentInChildren<MeshRenderer>();
        //hex = other.transform.GetChild(0).GetChild(0);
        foreach (Renderer color in childColors)
        {
            color.material = Dirt;
        }
    }
}

But idk what I should do.

`

void OnTriggerEnter(Collider other)
{

 if (other.gameObject.tag == "Grass")
 {
         //Obviously switch DIRT out for your variable containing the appropriate material
         gameObject.GetComponent<MeshRenderer>().material = DIRT;
 }