Creating grid on terrain

I’ve looked up countless tutorials on how to display a grid on the terrain surface and I’ve pretty much came back to the same conclusion everytime; make a script and attach it to the camera. The application I’m looking to make this for I can’t seem to figure out how to go about it.

Basically, what I’m con templating doing is every square in the grid is its own node, and an object can be assigned to that node. So say you have a village A and its randomly assigned to say Node at x: 430 y:23, then that node holds all the data.

The thing I’m curious about is how to approach it but I’m not sure which way would be the best way. I have 3 solutions in my head that I think will work.

  1. Create a script for the camera that displays the grid on the terrain making every 1 by 1 square its own Node in a gameObject array

  2. Create a script for the terrain that displays a drawing above the terrain doing the same as the camera

  3. Create the world using Quads or Cubes making each Quad its own node. (The problem I have with this one is it seems like it would be very performance heavy. Although this would only be rendered minimally cause this is just for a map and not actual gameplay).

Basically what I’m trying to recreate is a map like the game Tribal Wars just a more 3D view instead of 2D

Actually I think your best bet would be to go with a shader applied either directly to your terrain or on a transparent plane just over it. If you’re not comfortable with shaders at all you could also use a projector with a rectangular grid pattern since that seems to be all that you need for your implementation and just scale it so that each rectangle fits the area you need.

Make a second camera that is colocated to your current camera, and always stays “ganged” to it (same direction, position).

Make that second camera’s output go to a higher layer than the first, set its clear flag to “depth only” and then put a grid (geometry or texture on planes) in the scene, but flag their layer so that the first camera does NOT see it, but the second camer DOES see it. That means you have to make the first camera exclude the grid layer.