Hello,
I writing an editor which draws a lot of lines in scene view every frame. To do it I use Debug.DrawLines() within Update() of EditorWindow class. It draws about 400 lines in Scene per frame and it looks like these lines are not erased before next frame. After a while a warning appears:
vertexCount > 60000
UnityEditor.Handles:Internal_DrawBuiltinGizmos()
How can I draw such lines in scene view (every frame) efficiently?
Sorry of my English
I’ve never used Debug.DrawLine. If I needed lines in a scene, I would program it like this:
- create a cube with scale like (0.1, 0.1, 100). That will look like a line onscreen.
- apply a material with the color that you want
- make that into a prefab, in your Resources directory (so it’s simple to instantiate)
- during Update(), instantiate or destroy or reposition as many as you need to. You will need to position and rotate each one relative to the camera, and alter the scale-z value to change each one’s length