Multiple Material Single Objects

Before I even ask; I’d just like to say I don’t care how technical this gets, I’m more after a solution that works.

Is it possible in anyway to apply multiple materials to a single mesh?

In detail; I am trying to create a dynamically allocated mesh and apply a few materials to it; to date my knowledge in this area has led me to presume that I would need a texture atlas. In my current situation, this is undesirable, simply because several textures have detail maps which are nigh on imposible to atlas correctly - if no other answer is forth coming; I will probably go with this option, and make a shader that can handle it somehow.

Thanks in advance for any consideration in this problem.

Isn’t there a material array or something in mesh renderer?

Meshes take a array of materials, these link up to material ID of a imported mesh. In your case of using a procedural mesh, you will have to Mesh.subMeshCount and Mesh.SetTriangles more or less just set the subMesh count to the amount of materials you need, and when you do your setTriangles while constructing your procedural mesh you need to use the proper int in the submesh param.

the id you use in the submesh parm relates to the ID to use in the materials array

thankyou muchly :slight_smile: I will look into this.