Profile your mod
Add a Snitch panel to your mod. It shows your counters, state bars, buttons, toggles, sliders and log in the overlay and the web dashboard.
Snitch times OnUpdate, OnFixedUpdate, OnLateUpdate and OnGUI of every loaded mod without any code. Your mod already appears as <YourMod>.OnUpdate. Follow the steps only if you want more.
You need: Snitch in your test game and a MelonLoader mod project. Players do not need Snitch: every call is a no-op without it.
-
Copy
Snitch.csfrom ScheduleOne-SnitchExample into your project. It compiles into your DLL. You can referenceSnitch.Api.dllinstead. -
Add a static class named
SnitchProbewith a staticRegister()method. Snitch finds and calls it. You do not call it yourself. -
Register a panel in
Register()and add controls.using Snitch.Api; // Profiler, Panel, StateSnapshotinternal static class SnitchProbe{public static void Register(){Panel p = Profiler.RegisterPanel("MyMod", "My Mod");p.Counter("QueueLength", () => MyMod.Queue.Count, "items");p.State("Jobs", () => new StateSnapshot { Title = "Jobs" }.Add("running", MyMod.Running).Add("queued", MyMod.Queued));p.Text(() => $"mode: {MyMod.Mode}");p.Action("Flush queue", () => MyMod.Flush());p.Toggle("Verbose", () => MyMod.Verbose, v => MyMod.Verbose = v);p.Slider("batch size", 1, 64, () => MyMod.Batch, v => MyMod.Batch = (int)v, 1);p.Log();}} -
Time a hot section by hand. The call allocates nothing and does nothing when Snitch is not sampling.
using (Profiler.Sample("MyMod.Pathfinding")) { /* expensive work */ }// Skip even the call on a hot loop:if (Profiler.Enabled) using (Profiler.Sample("MyMod.Tick")) { /* ... */ } -
Optional: register an ablation lever.
snitch ablate mymod.fxthen measures what your subsystem costs per frame.Profiler.RegisterAblationLever("mymod.fx", apply: () => DisableFx(), restore: () => EnableFx()); -
Optional: mark a one-off spike with
Profiler.Mark("MyMod.LevelLoaded").
Check it works
Section titled “Check it works”- Start the game and run
snitch startin the console. - Run
snitch panels. Your panel and its control counts appear. - Open the panel from the
windowslist of the Overview window, or in the web dashboard.

- Call the API from the Unity main thread. Snitch also runs your counter, state, action, toggle and slider delegates on the main thread, so they may use game objects.
- Prefix labels with
MyMod.so they group per mod. - Write log lines with
p.Write("...")orProfiler.Log("MyMod", "..."). They appear in your panel and in the combined timeline. - Registrations made before Snitch loads are queued. Load order does not matter.
- Lower-level calls exist:
Profiler.RegisterCounter,RegisterStateProvider,RegisterAction,RegisterToggle,RegisterSlider,RegisterText,Log.