public static void RestorePreviousPersistentTool() { var last = EditorToolContext.GetLastTool(x => x && !EditorToolUtility.IsCustomEditorTool(x.GetType())); if (last != null) { SetActiveTool(last); } else { SetActiveTool <MoveTool>(); } }
internal static EditorTool GetEditorToolWithEnum(Tool type) { if (type == Tool.View) { return(EditorToolContext.GetSingleton <ViewModeTool>()); } if (type == Tool.Transform) { return(EditorToolContext.GetSingleton <TransformTool>()); } if (type == Tool.Move) { return(EditorToolContext.GetSingleton <MoveTool>()); } if (type == Tool.Rotate) { return(EditorToolContext.GetSingleton <RotateTool>()); } if (type == Tool.Scale) { return(EditorToolContext.GetSingleton <ScaleTool>()); } if (type == Tool.Rect) { return(EditorToolContext.GetSingleton <RectTool>()); } if (type == Tool.Custom) { var tool = EditorToolContext.GetLastTool(x => GetEnumWithEditorTool(x) == Tool.Custom); if (tool != null) { return(tool); } } return(EditorToolContext.GetSingleton <NoneTool>()); }