/// <summary>
 /// Toggles the state of active editor tool with the type passed in.
 /// </summary>
 /// <remarks>
 /// This will change the current active editor tool if the type passed in
 /// is not the same as the current active editor tool. Otherwise, it will
 /// set the View Mode tool as the current active editor tool.
 /// </remarks>
 /// <param name="type">
 /// The type of editor tool. This must be inherited from EditorTool.
 /// </param>
 public static void ToggleActiveEditorTool(Type type)
 {
     if (ToolManager.activeToolType != type)
     {
         SetActiveEditorTool(type);
     }
     else
     {
         // Switch out of TilemapEditorTool if possible
         var lastTool = EditorToolManager.GetLastTool(x => !(x is TilemapEditorTool));
         if (lastTool != null)
         {
             ToolManager.SetActiveTool(lastTool);
         }
         else
         {
             ToolManager.SetActiveTool(typeof(ViewModeTool));
         }
     }
 }