c# – How to properly render a 2D outline in Unity?
I try to render a box, but I noticed that the thickness is displayed very inconsistently: 
Meaning that the line to the south might appear much thicker than the other lines (but it is not always south). The inconsistency also stays if I zoom in. How to do it properly? This is how the line renderer is used in code:
private void InitializeOutlineRenderer()
{
outlineRenderer = GetComponent();
outlineRenderer.enabled = true;
outlineRenderer.useWorldSpace = false;
Vector3[] corners = new Vector3[]
{
new Vector3(0, 0, 0),
new Vector3(0, 2, 0),
new Vector3(2, 2, 0),
new Vector3(2, 0, 0),
new Vector3(0, 0, 0)
};
outlineRenderer.positionCount = corners.Length;
outlineRenderer.material = new Material(Shader.Find("Sprites/Default"));
outlineRenderer.widthMultiplier = 0.08f;
outlineRenderer.SetPositions(corners);
outlineRenderer.material.color = Color.white;
}
Read more here: Source link

