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.

2 Answers

2

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

Thanks, I will study these ideas!

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.