Handle multiple Materials in Script

Hello,
I got an GameObject(House) with like 5 Materials. I want to change the Material to another one while placing the House in the world. How am i Able to do that?
i tried to save the Materials with
previousMaterials(array) = Renderer.materials;
then i tried to do an loop:
for(int i = 0; i < previousMaterials.length; i++)
and in the loop set the materials back to default:
Renderer.materials = previousMaterials*;*
I also tried sharedMaterials and all other ways i could find but none of them worked.
ID would be nice if i can just say Render.materials = previousmaterials without any loops or some.
Im new to Game Development and hope u can help me with this…

You are likely extremely close to getting it.

First, copy the array out (once!), then change the Materials you want (as many as you like in the array), then assign the array back in (once!).

Here’s more details:

Materials materials array of materials renderer:

Thanks… I will try tomorrow