If you set “Handles.zTest = CompareFunction.Less” this has no effect on “Handles.DotHandleCap” it only works with “Handles.DotCap” but this function is obsolete.
So how can I solve this or is this a bug in Unity?
My test code:
[CustomEditor(typeof(MyTestCode))]
public class DotHandleTestEditor : Editor
{
protected virtual void OnSceneGUI()
{
Handles.zTest = CompareFunction.Less;
Quaternion lookAtRot = Quaternion.LookRotation(Camera.current.transform.position);
float size = HandleUtility.GetHandleSize(Vector3.zero);
if (Handles.Button(Vector3.zero, lookAtRot, size * 0.05f, size * 0.07f, Handles.DotCap))
Debug.Log("zTest works fine on this one");
lookAtRot = Quaternion.LookRotation(new Vector3(20, 0, 0) - Camera.current.transform.position);
if (Handles.Button(new Vector3(1,0,0), lookAtRot, size * 0.05f, size * 0.07f, Handles.DotHandleCap))
Debug.Log("zTest is not working on this one");
}
}