internal static void RecalculateSelectedElementGroups()
        {
            if (!s_SelectedElementGroupsDirty)
            {
                return;
            }

            s_SelectedElementGroupsDirty = false;
            s_ElementSelection.Clear();

#if UNITY_2020_2_OR_NEWER
            VertexManipulationTool activeTool = null;
            var editorTool = EditorToolManager.activeTool;
            if (editorTool is VertexManipulationTool)
            {
                activeTool = (VertexManipulationTool)editorTool;
            }
#else
            var activeTool = ProBuilderEditor.activeTool;
#endif

            if (activeTool != null)
            {
                foreach (var mesh in s_TopSelection)
                {
                    s_ElementSelection.Add(activeTool.GetElementSelection(mesh, VertexManipulationTool.pivotPoint));
                }
            }
        }
        static void SetTool <T>() where T : VertexManipulationTool, new()
        {
            //If the type is already active do nothing
            if (typeof(T) == ToolManager.activeToolType)
            {
                return;
            }

            VertexManipulationTool formerTool = null;

            if (EditorToolManager.activeTool is VertexManipulationTool)
            {
                formerTool = (VertexManipulationTool)EditorToolManager.activeTool;
            }
            ToolManager.SetActiveTool(CreateInstance <T>());
            if (formerTool != null)
            {
                DestroyImmediate(formerTool);
            }
        }