A good way to draw a lot of lines (3d grid)?

Hello,

I am working on a grid system for RTS-type game (practicing Unity) and looking for a good way to draw grid over terrain.

Right now i got a generic list of TerrainGrid objects with four Vector3’s and a AllowBuilding boolean that is calculated procedurally accounting slope etc.

I need to draw a grid between those 4 points, grid color (green/red) depends on AllowBuilding boolean.

There is a lot of TerrainGrid (10k+) objects in that list, since grid size is 5-20 units and terrain is 1000x1000+

Right now i test it with Debug.DrawLine, but it is of course slow.

I thought about creating and pooling a bunch of LineRenderers, and enabling them when player is trying to build something, but today i found a hint that LineRenderer is not very suitable for this task and will be slow.

I do not want to mess with GL unless i do not have any other options.

Any advices?

If a commercial asset is a possibility for you, I can highly recommend Vectrosity.

And, just to be clear, I have no affiliation with the asset - I’m just a satisfied customer.

If youre able to make the grid already, have you tried setting up projectors?

heres an image of someone doing what it sounds like you want except with a hexgrid