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?
Answer by jgodfrey · Apr 02, 2016 at 02:25 PM
If a commercial asset is a possibility for you, I can highly recommend Vectrosity.
https://www.assetstore.unity3d.com/en/#!/content/82
And, just to be clear, I have no affiliation with the asset - I'm just a satisfied customer.
Isnt Vectrosity a bit overkill for just drawing some straight lines?
Answer by b1gry4n · Apr 08, 2016 at 12:31 AM
If youre able to make the grid already, have you tried setting up projectors?
http://docs.unity3d.com/Manual/class-Projector.html
heres an image of someone doing what it sounds like you want except with a hexgrid
Your answer
![](https://koobas.hobune.stream/wayback/20220612074036im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Load heightmap automatically 0 Answers
Unity application suddenly slow 1 Answer