private bool HandleClick(Vector3 localPos, int btn) { if (LevelEditor.EditState == EditState.Vertices && btn == EditWindowClickDetection.BTN_PRIMARY) { var ray = EditWindow.GetRayFromMousePosition(localPos); //raycast with vertices if (Physics.Raycast(ray, out RaycastHit hitInfo, float.MaxValue, vertexLayerMask)) { var vertex = hitInfo.transform.gameObject.GetComponent <EditableVertex>(); if (vertex != null) { Deselect(); currentlySelected = hitInfo.transform.gameObject; Gizmo.Attach(currentlySelected.transform, Vector3.zero); Gizmo.Visible = true; return(true); } } else { Deselect(); } }