Unity Changing Runtime Textures

To change an object’s texture ‘runtime’ via code:

public Texture theTexture;
gameObject.GetComponent<Renderer> ().material.SetTexture (“_MainTex”, theTexture);