Placing the grid at the center of the terrain and making it fit the entire terrain may be not a good idea if your terrain is very big. In this case and depending on your requirements, it’s possible that you will need to draw a lot of cells. Although this can be done just entering the proper number of rows and columns in the inspector, it’s not performance wise.
A solution for big terrains is just draw a portion of the grid around the character. For that, you need to set gridCenter and gridScale properties.
-
GridCenter values range from -0.5 (left most side of the terrain) to 0.5 (right most side of the terrain). By default gridCenter is set to 0,0, which matches the center of the terrain. Setting it to -0.5, 0.5 for example will center the grid on the top/left corner of the terrain.
-
GridScale values range from 0 to 1 and are relative to the terrain size. So a scale of 0.1,0.1 will make the grid a 10% of the size of the terrain.
Another useful property is gridCenterWorldSpace which lets you assign a world space position directly and the grid will be displayed around that point. For example you can assign the character transform.position to this property.
Check out demo scenes 10 and 10b for useful examples.