Correctly applying materials to procedural meshes

Hey,

I have a tool that creates randomly generated low poly meshes, and I have a material of a stone wall. When I apply the material to a standard Unity cube, I see all the bricks as expected, but when I apply it to my procedural mesh, the bricks don’t show up, the mesh has 1 consistent color.

What is the issue here and in what direction should I look to solve this?

Alex

You have to generate UV coordinates for every vertex in your mesh. There is no “correct way” how those should look like since it entirely depends on your mesh. UV unwrapping is usually done manually by an artist for modelled objects. When you generate your meshes procedurally you have to take care of generating the UVs procedurally so the texture looks the way you want it to look.

See UV mapping. Here’s a blog post that explains UV coordinates briefly

edit
I’ve once written an UVViewer editor window which allows you to view the UV unwrap of an object in the scene inside Unity. Just place this script into an “editor” folder in your project and open it via: “Tools → B83 → UVViewer” from the menu