Seemingly simple question…
In my c# code I do:
public GameObject Sphere_meshGO;
public Texture sphereTex;
GOmesh = (GameObject) Instantiate (Sphere_meshGO, new Vector3 (0, 0, 0), Quaternion.identity);
How do I assign sphereTex texture to the GOmesh object I just created?
I read that its dhould be:
GOmesh.renderer.material.mainTexture = sphereTex;
But this won’t compile (.renderer does not resolve).
What’s the code to assign a texture to GOmesh?