I am attempting to draw a 2D grid on a plane (which is my “floor”) as a sort of game board. I have made a script to generate a texture to render:
void GenerateGrid()
{
Color gridColor = Color.cyan;
Color borderColor = Color.black;
Collider floorCollider = floor.GetComponent<Collider>();
Vector3 foorSize = new Vector3(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
for (int x = 0; x < gridImage.width; x++)
{
for (int y = 0; y < gridImage.height; y++)
{
if (x < borderSize || x > gridImage.width - borderSize || y < borderSize || y > gridImage.height - borderSize)
{
gridImage.SetPixel(x, y, new Color(borderColor.r, borderColor.g, borderColor.b, 50));
}
else gridImage.SetPixel(x, y, new Color(gridColor.r, gridColor.g, gridColor.b, 50));
}
gridImage.Apply();
}
}
However, I cannot for the life of me think of any way to draw this texture multiple times in a grid format onto the plane in question. I have checked the documentation and was trying to see if I could use Graphics.DrawTexture() or anything of the like that would help me. Maybe I was using it wrong. I really don’t want to instanciate hundreds of gameobjects in the shape of a grid though… any advice?

