Applying a texture

Hi, I am making a tower defence game and I'm currently trying to instantiate turrets. I have turrets placed in the possible locations and set to inactive and when they are chosen to be changed to active. However I am trying to implement different turrets to use. Is there a way I could change the material of the inactive turret to that of the desired turret I wish to use when it is to be activated? I'm trying to implement in C sharp. Thanks.

Take a look at the reference: Material.mainTexture

renderer.material.mainTexture = texture;