So for my game I need the ability to add a grid overlay over my tilemap. Now I don't think that making the grid with each cell being its own GameObject with some SpriteRenderer would be hard to do but I know it would be extremely inefficient. I was thinking about using a LineRenderer to draw the grid lines but I don't know how to make the cells have their own traits since they wouldn't be their own individual instance and more of a product of the grid lines. In my case, the cells need their own color and should all have the ability to be accessed individually and that's where I need your help. Do you guys have an idea on how to make this efficient?
You could make an array of structs with a struct for each cell, that includes the cell's grid coordinates and color. Then copy this into a vertex array for rendering so you have a vertex for each cell, and use a geometry shader to turn each vertex into a quad with its own color, and draw the whole grid as 1 object.
You want a grid of size N. Apply a custom shader to your tilemap. In that shader, set every pixel at (x mod N, ?) And (?, y mod N) to your desired color. (In world coordinates) The (x mod N, y mod N) gives you the current relative cell coordinates, allowing you to change drawing properties as desired.
Of course, you can easily blend with the existing texture color rather than outright replacing it, if you so choose.