- Home /
Create a grid
Hi guys.
I'm wondering how I could make a grid like the one we see in Unity. I thought about placing a set of planes together, but I don't know if this is the best solution for this.
Thanks for any help.
Answer by paulaceccon · Apr 09, 2013 at 11:54 AM
Hi, I was able to create a grid with GL in Unity.
void OnRenderObject()
{
CreateLineMaterial();
lineMaterial.SetPass( 0 );
GL.PushMatrix();
GL.Begin( GL.LINES );
GL.Color(Color.grey);
/* Horizontal lines. */
for (int i = -rows/2; i <= rows/2; i++) {
GL.Vertex3(-columns/2, 0, i);
GL.Vertex3(columns/2, 0, i);
}
/* Vertical lines. */
for (int i = -columns/2; i <= columns/2; i++) {
GL.Vertex3(i, 0, -rows);
GL.Vertex3(i, 0, rows);
}
GL.End();
GL.PopMatrix();
}
This is what I've done.
Answer by robertbu · Mar 27, 2013 at 03:53 PM
Use a single plane and create a grid texture in Photoshop. If you wanted to take it a step further, then instead of creating a whole grid texture, create a grid tile. Then you can tile the texture in the material settings to get the grid look you want. There are a number of Photoshop tutorials about creating grids. Another possibility is to use the grid projector:
http://docs.unity3d.com/Documentation/Components/class-Projector.html
Your answer
Follow this Question
Related Questions
Rounding Errors when snapping to grid 2 Answers
How to render a grid on non-flat world mesh / terrain 2 Answers
Planes and other Gameobjects disppear as I dolly/rotate the camera and in render mode 0 Answers
How to make Occlusion Culling for SpriteRenderer ? 0 Answers
2d rendering/ occlusion 0 Answers