Hi,
I made a simple gizmo for my 2D shooter game in order to display the boundaries for my spaceship’s movement (in green), and a visualisation of its movement speed (in red)
But the gizmo is inconsistently rendered in the editor, some lines appear super thin, almost invisible while some appear just nice, and if I zoom out, it’s other lines that become invisible.
I have the problem in both the scene view and the game view.
Any idea of a way I could solve this? Only workaround I found was to add a for loop to draw each line several times and offset them by 0.01f
edit:
here’s my code.
void DrawBoundsGizmo(Rect zone) {
Gizmos.color = Color.green;
Gizmos.DrawLine (new Vector3 (zone.xMin, zone.yMin), new Vector3 (zone.xMin, zone.yMax));
Gizmos.DrawLine (new Vector3 (zone.xMin, zone.yMax), new Vector3 (zone.xMax, zone.yMax));
Gizmos.DrawLine (new Vector3 (zone.xMax, zone.yMax), new Vector3 (zone.xMax, zone.yMin));
Gizmos.DrawLine (new Vector3 (zone.xMax, zone.yMin), new Vector3 (zone.xMin, zone.yMin));
}