title: How to set texture on model programmatically
body: <p>I have been trying to make the apple textured by putting in these codes:</p>
  
  <pre><code>GameObject cube = Instantiate(Resources.Load("apple", typeof(GameObject))) as GameObject;
  Texture my3dModelTexture = Resources.Load("Textures/apple2", typeof(Texture)) as Texture;
  cube.renderer.material.mainTexture = my3dModelTexture;
  </code></pre>
  
  <p>However, my apple appeared to be untextured. But then I tried the same concept on a cube, and it is working.</p>
  
  <pre><code>GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
  </code></pre>
  
  <p>Could someone please help? I have been trying a lot of methods, but none of them seem to work and I still cant find the reason why.</p>