- Home /
Question by
TwistedPixel · Jan 04, 2011 at 06:15 AM ·
texturemeshmaterial
Mesh wont accept material?
I have made a mesh Exported it in FBX imported it into unity scaled and displays fine but wont accept a material/ texture. just adopts the main color of any aplied mat tried all different shaders and fiddled with it for hours. Now im having to ask, Thanks in advance.
Comment
Best Answer
Answer by TwistedPixel · Jan 05, 2011 at 10:16 AM
Ok For others that are having this trouble.
function Start () { var mesh : Mesh = GetComponent(MeshFilter).mesh; var vertices : Vector3[] = mesh.vertices; var uvs : Vector2[] = new Vector2[vertices.Length]; for (var i = 0 ; i < uvs.Length; i++) uvs[i] = Vector2 (vertices[i].x, vertices[i].z); mesh.uv = uvs;}
put that code in a Javascript and attach it to the mesh.
Answer by Jessy · Jan 04, 2011 at 06:59 AM
You haven't UV'd it.
You also haven't searched the Unity community for an answer.
Thanks for your help. I had searched just not knowing what to search for makes the job difficult. the keyword "UV" was the key to solving my problem. I wouldnt have known without your help.