How can i set multiple materials to a generated mesh

I am creating a procedural model generator. I know how to create the mesh, set the faces and set uv coordinates. What I wish to know is is it possible to assign different materials per face?

Yes it is. You need to use sub meshes though and bear in mind that each of these will cause an extra draw call - so perhaps consider that you might be able to find a better way of achieving your result using a more custom shader.

If you want to create a sub mesh use SetTriangles rather than assigning the triangles array. After doing this the materials array for the renderer should be filled in with the materials for each sub mesh.