private void DrawEnableButton(Rect rect, MethodInfo method, string methodString) { var tooltip = $"Enable stack trace profiling"; var height = rect.height; if (height > 25f + Text.LineHeight) { DubGUI.CenterText(() => Widgets.Label(rect.TopPartPixels(Text.LineHeight), "Enable")); rect.AdjustVerticallyBy(Text.LineHeight); } if (currentlyTracking) { Widgets.DrawHighlightSelected(rect); } var centerRect = rect.CenterWithDimensions(25, 25); TooltipHandler.TipRegion(centerRect, tooltip); if (Widgets.ButtonImage(centerRect, Widgets.CheckboxOnTex)) { if (currentlyTracking is false) { StackTraceUtility.Reset(); currentTrace = 0; currentTrackedStacktraces = 0; Modbase.Harmony.Patch(method, postfix: new HarmonyMethod(postfix)); } else { ThreadSafeLogger.ErrorOnce($"Can not retrace {methodString} while currently tracing", method.GetHashCode()); } currentlyTracking = true; } }