Help to change emission in multiple materials

Hi guys
i have a little problem with some scripting thing…
i already have the script to change the materials but only happens to
the first material, and i want to change to the other materials from the same object

if (flashObject) {
    defaultColor = flashObject.material.GetColor("_EmissionColor");
    flashObject.material.SetColor("_EmissionColor", hitFlashColor);
    }
    yield return new WaitForSeconds(1);
    if (flashObject) flashObject.material.SetColor("_EmissionColor", defaultColor);

is there any way to change the emission to the other materials??, its 7 in total

thanks in advance

You can get all of the materials from the renderer through the aptly named materials property: Unity - Scripting API: Renderer.materials

Then it’s just a matter of looping through them.