I’m trying to switch from using Unity’s Gizmos to ALINE.
The Unity Gizmos code which looks like this:
foreach (Region region in RegionManager.Regions.Values)
{
Gizmos.color = Color.green;
foreach (Vector3Int node in region.Nodes)
{
Gizmos.DrawWireCube(new Vector3(node.x, node.y, 0), new Vector3(1, 1, 1));
}
Gizmos.color = Color.red;
Gizmos.DrawWireCube(new Vector3(region.Rect.center.x - 0.5f, region.Rect.center.y - 0.5f, 0), new Vector3(region.Rect.width, region.Rect.height, 1));
}
Results in this performance (and preview):
However, the equivalent code of ALINE:
foreach (Region region in RegionManager.Regions.Values)
{
foreach (Vector3Int node in region.Nodes)
{
Draw.WireRectangle(new float3(node.x, node.y, 0), Quaternion.Euler(-90, 0, 0), new float2(1, 1), Color.green);
}
Draw.WireRectangle(new float3(region.Rect.center.x - 0.5f, region.Rect.center.y - 0.5f, 0), Quaternion.Euler(-90, 0, 0), new float2(region.Rect.width, region
.Rect.height), Color.red);
}
Results in this performance (and preview):
That’s almost 4x the difference and I have no idea what I’m doing wrong. I know it’s not optimal to be drawing this many things for debugging, but I’ll require similar functionality in-game too (when I’ll be using Draw.ingame.something). How can I fix this?
Additionally, I’ve noticed (and you can see this in the images) that the Unity gizmos when zooming out start fading away and getting thinner (as they should), but ALINE rectangles seem to keep this “minimum thickness” and you can see the entire map is very green compared to Unity gizmos. How can I fix this? I want the lines to remain small when the player zooms out the camera.