Skip to content

Instantly share code, notes, and snippets.

@barleymalt
Created October 20, 2022 14:11
Show Gist options
  • Save barleymalt/bf50c7b961a021ff29122c39a8bad71d to your computer and use it in GitHub Desktop.
Save barleymalt/bf50c7b961a021ff29122c39a8bad71d to your computer and use it in GitHub Desktop.
a simple gist to create a grid of vertices
// catlike coding
private Vector3[] Generate(int xSize, ySize)
{
Vector3[] vertices = new Vector3[(xSize + 1) * (ySize + 1)];
for (int i = 0, y = 0; y < ySize; y++)
{
for (int x = 0; x < xSize; x++, i++)
{
vertices[i] = new Vector3(x, y);
}
}
return vertices;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment