# Given a position, how do I figure out Pixel's Per Unit?

I have a custom editor for my scene which demonstrates the playable radius (how close my game ships will get to an object before slowing. The problem is that the circle draws a single line, and I want it a little thicker, say 3 pixels wide.

I can set that with this for now:

``````        Handles.DrawWireDisc(transform.position, Vector3.up, Radius);
``````

But if I zoom in or out, then the lines become just 1 line, or spread apart, loosing the effect. I’m looking for away to guarantee the next radius will be 1 pixel out.

Not pixel perfect but does the job (keeps constant size): ``````using System.Collections.Generic;
using UnityEngine;

public class GlGizmo : MonoBehaviour
{
[SerializeField][Range(3,32)] int _lineCount = 12;
[SerializeField][Range(0.001f,1f)] float _unitWidth = 0.1f;//width when distance to camera is 1.0

void OnDrawGizmos ()
{
System.Func<int,int,Vector3> CalcPoint = ( i , max ) =>
{
float f = i / (float)max;
float angle = f * Mathf.PI * 2;
};

float dist = Vector3.Distance( Camera.current.transform.position , transform.position );

GL.PushMatrix();
GL.MultMatrix( transform.localToWorldMatrix );
( new Material( Shader.Find("Sprites/Default") ) ).SetPass(0);//replace material to customize render style
{
//set color:
GL.Color( Color.white );

//warm up:
{
Vector3 A0 = CalcPoint( 0 , _lineCount );
Vector3 B0 = A0 + A0.normalized*_unitWidth*dist;
GL.Vertex( A0 );
GL.Vertex( B0 );
}

//segments:
for( int i=1 ; i<=_lineCount ; i++ )
{
Vector3 A = CalcPoint( i , _lineCount );
Vector3 B = A + A.normalized*_unitWidth*dist;

if( i%2==0 )//even
{
GL.Vertex( A );
GL.Vertex( B );

GL.Vertex( A );
GL.Vertex( B );
}
else//odd
{
GL.Vertex( B );
GL.Vertex( A );