Can you assign a material to all Items within an Empty Game Object at once?

Is there a way to assign a material to the items within a Empty GameObject without having to texture them 1 by 1? I am still a newbie and have been working with ProBuilder, so I would appreciate a solution that does not require me to mess with the code. I am dealing with gameObjects that have over 100 items each.

I think this should do it:

foreach(Renderer r in GetComponentsInChildren<Renderer>()}
{
	r.material = yourMaterial; //Set material.
}

Let us know if it worked as you intended!