Can I Assign Different Material To Each Quad In A Mesh?

Basically, I have a 2D level map I’m building procedurally for a Match 3 type game. I have the data structure for the grid and path the user will take. I also have a method that builds a mesh based on the existing grid and path data structure.

unfortunately, there’s a gap in my knowledge. I can make a single material span the entire mesh properly but I can’t figure out how to make a single tile span only one quad on the mesh. The idea being that I have a tilemap spritesheet that has tiles, each representing something different(tree, path, grass, rock, etc.).

I understand that I can do some math to figure out the range and size the quad spans relative to the mesh, however, how do I actually change the material that should be painted to the specific quad?

You’d need to make a submesh for each material, however that’s not a good way to do it. Instead use a texture atlas and UV mapping.