Handles.DotHandleCap ztest issue
I don't want to draw a dot when an object is in front of it. As you can see in this image: I can do this with Handles.DotCap and set Handles.zTest = CompareFunction.Less. The problem is Handles.DotCap is Obsolete. And when I try Handles.DotHandleCap ztest does not seem to work. So how can I solve this or is this a bug in unity?
[CustomEditor(typeof(Test))]
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("This one works fine");
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("This one does not do what I want");
}
}
ezgif-5-54dbb9e2c1.gif
(508.1 kB)
Comment
Your answer
Follow this Question
Related Questions
How to reduce editor refresh time? 0 Answers
Is the glitch fixed? 0 Answers
Strange behaviour: Active child in inactive parent 0 Answers
Custom Editor Inspector member class with inheritance, values resets after starting Play Mode 1 Answer
Issue? For loops run slower while viewing object in inspector 0 Answers