Extending
Everything below works with no compile switches: in builds that leave Shipready out, each call does nothing.
Add to every report #
BugReporter.AddBreadcrumb("Opened the shop"); // a line in Recent events
BugReporter.SetContext("Level", "Forest 2"); // a line in Game state; null removes it
BugReporter.AddContextProvider(myProvider); // IReportContextProvider, read when a report starts
BugReporter.AddAttachment("save.dat", () => File.ReadAllBytes(savePath));
ReportPrivacy.Redact = text => Regex.Replace(text, @"\S+@\S+", "<email>");
With no code: add a Report Context Source component and list values to read from your components.
Open, save and listen #
BugReporter.Open(); // the form, with a fresh screenshot
BugReporter.Open("Boss fight softlocked"); // with What happened filled in
BugReporter.SaveQuickReport("Crash in level 3"); // straight to a zip, no form
BugReporter.ReportSaved += result => Debug.Log(result.ZipPath);
BugReporter.FormOpened += PauseMyInput;
BugReporter.FormClosed += ResumeMyInput;
Console commands and options #
[DebugCommand("give_gold", "Adds gold.")]
static string GiveGold(int amount) { Gold += amount; return "Gold " + Gold; }
[DebugOption("Cheats/God Mode")] bool godMode;
[DebugOption("Tuning/Speed", Min = 0, Max = 20, Step = 0.5f)] float speed;
[DebugOption] void ResetLevel() { }
void OnEnable() { DebugOptions.Register(this); DebugCommands.Register(this); }
void OnDisable() { DebugOptions.Unregister(this); DebugCommands.Unregister(this); }
Static commands are found by themselves. With no code: a Debug Options Source component lists values and methods
by name. From code: DebugOptions.AddToggle, AddNumber, AddButton, AddReadOnly, DebugCommands.Add.
Your own UI, destinations and input #
BugReporter.UseForm(IBugReportForm): your form gets aReportSessionwith the screenshot, markup, parts andSubmit.BugReporter.UseOverlay(IDebugOverlay): your console; read lines withBugReporter.GetLog()and watchBugReporter.LogVersion.BugReporter.AddDestination(IReportDestination): send reports anywhere; the local zip is always saved first.BugReporter.UseKeySource(IReportKeySource): your own input code for the keys.BugReporter.KeysBlocked: return true while Shipready's keys should do nothing, such as while your chat box is open.BugReporter.TesterCamera: return the camera the player sees through, for split screen or an untagged camera.BugReporter.UseTheme(theme),UsePreset(preset),ThemeChanged: switch the look while playing.ReportText.Translate: reword or localise every word.