- Home /
Generated meshs and lights
Hi guys, i have a question regarding generated meshes and lights.
Code:
vertices.Add(new Vector3(0,0,0));
vertices.Add(new Vector3(20,0,0));
vertices.Add(new Vector3(20,20,0));
vertices.Add(new Vector3(0,20,0);
uvs.Add(new Vector2(0,0));
uvs.Add(new Vector2(1, 0));
uvs.Add(new Vector2(1, 1));
uvs.Add(new Vector2(0, 1));
triangles.Add(0);
triangles.Add(2);
triangles.Add(3);
triangles.Add(3);
triangles.Add(1);
triangles.Add( 0);
mesh.vertices = vertices;
mesh.triangles = triangles ;
mesh.uv = uvs;
mesh.RecalculateNormals();
I added 10 of those meshes, just for testing (some with more than 2 vertices & triangles) Also im using the buildin mobile bumbed diffuse shader and i added an arena light to the scene.
Any idea why the mesh wont be affected by the light?
Thanks!
did you actually add materials and textures and so on?
A good trick is - it's an incredible pain to start totally fresh and make a whole object. Try ins$$anonymous$$d: create a totally simple "base" object in a scene (so, a cube) with a texture on it and so on.
Now, make your mesh. take your "base" object and in fact change it's mesh to your new test mesh.
this is usually a far better pipeline than truly building an object from scratch.
Your answer
Follow this Question
Related Questions
Blares appear at the junction of two meshes 0 Answers
Unity pro 4, shadow problems 0 Answers
Why Does Lightmapping make everything Super Bright? 0 Answers
Using shadows as Triggers? 1 Answer
Can't get dynamic shadows working 1 Answer