API Reference

Three integration points: attributes, the static Jahro class, and lifecycle events.

Attributes

JahroCommand

Marks a C# method as a debug command executable from the Jahro console.

[JahroCommand()]                               // uses method name
[JahroCommand(string name)]
[JahroCommand(string name, string group)]
[JahroCommand(string name, string group, string description)]

Parameters

ParameterTypeDefaultDescription
namestringMethod nameUnique command identifier. Spaces are stripped automatically.
groupstring"Default"Groups related commands in the Visual interface.
descriptionstringShown as a tooltip in Visual mode.

Example

using JahroConsole;
using UnityEngine;
 
public class Cheats : MonoBehaviour
{
    [JahroCommand("add-gold", "Cheats", "Add gold to the player")]
    public void AddGold(int amount) { /* ... */ }
 
    [JahroCommand] // resolves to "Ping"
    public void Ping() { Debug.Log("pong"); }
}

Gotchas

  • Static and instance methods both work. For instance methods, you must call Jahro.RegisterObject(this) — the attribute alone is not enough.
  • If you define overloads, Text mode resolves the correct overload through parameter mapping. Visual mode treats each overload as a separate command.

See Commands for runtime behavior and Text mode parsing rules.


JahroWatch

Marks a field or property for display in Watcher mode, where you can monitor live values during play.

[JahroWatch()]                                        // uses member name
[JahroWatch(string name)]
[JahroWatch(string name, string group)]
[JahroWatch(string name, string group, string description)]

Parameters

ParameterTypeDefaultDescription
namestringMember name (leading _ stripped)Display label in the Watcher panel.
groupstring"Default"Groups related watchers visually.
descriptionstringShown in the details modal.

Example

using JahroConsole;
using UnityEngine;
 
public class Player : MonoBehaviour
{
    [JahroWatch("Player HP", "Vitals", "Current hit points")]
    public int hp;
 
    [JahroWatch("Position", "Player")]
    public Vector3 Position => transform.position;
}

Gotchas

  • Values are only polled when Watcher mode is open — no overhead when you're not watching.
  • Works on static and instance members. Instance members require Jahro.RegisterObject(this).

See Watcher for the full Watcher interface and polling behavior.


Namespaces and Assemblies

Path
NamespaceJahroConsole
Runtime assemblyAssets/JahroPackage/Runtime/…
Editor assemblyAssets/JahroPackage/Editor/…

Runtime API: Jahro

Static entry point: JahroConsole.Jahro.

State and Lifecycle

public static bool Enabled { get; }         // reflects Jahro Settings; can auto-disable on release builds
public static bool IsOpen { get; }          // true if the console window is visible
public static bool IsReleased { get; }      // true after Release() was called
 
[RuntimeInitializeOnLoadMethod]
public static void InitializeIfNeeded();    // called automatically — don't invoke manually
 
public static void Release();              // flush and dispose (call before assembly reload if needed)

Events

public static UnityAction OnConsoleShow;   // fires when the console window opens
public static UnityAction OnConsoleHide;   // fires when the console window closes

Gotcha

Enabled reads from Tools > Jahro Settings. If you see commands silently no-oping, check that Jahro is enabled for the current build configuration.


View Control

public static void ShowConsoleView();
public static void CloseConsoleView();

Launch button

public static void EnableLaunchButton();
public static void DisableLaunchButton();
public static void ShowLaunchButton();
public static void HideLaunchButton();
 
public static bool IsLaunchButtonEnabled { get; }

The launch button is draggable; its position persists across sessions automatically.


Object Registration

Register an instance so Jahro can scan it for [JahroWatch] and [JahroCommand] members.

public static void RegisterObject(object obj);
public static void UnregisterObject(object obj);

Standard pattern

void OnEnable()  => Jahro.RegisterObject(this);
void OnDisable() => Jahro.UnregisterObject(this);

Gotchas

  • Passing null logs an error and does nothing.
  • Always pair RegisterObject with UnregisterObject. Forgetting to unregister leaks the reference and keeps stale watchers alive.

Commands — Dynamic Registration

Use these when you can't use [JahroCommand] — for example, when binding lambdas or registering commands from a system that doesn't own the method.

Bind by method name

public static void RegisterCommand(
    string name,
    string description,
    string groupName,
    object obj,
    string methodName
);
 
// Convenience overloads:
public static void RegisterCommand(string name, object obj, string methodName);
public static void RegisterCommand(string name, string description, object obj, string methodName);

Bind delegates

// No params
public static void RegisterCommand(string name, Action callback);
public static void RegisterCommand(string name, string description, Action callback);
public static void RegisterCommand(string name, string description, string groupName, Action callback);
 
// One param
public static void RegisterCommand<T>(string name, Action<T> callback);
public static void RegisterCommand<T>(string name, string description, Action<T> callback);
public static void RegisterCommand<T>(string name, string description, string groupName, Action<T> callback);
 
// Two params
public static void RegisterCommand<T1, T2>(string name, Action<T1, T2> callback);
public static void RegisterCommand<T1, T2>(string name, string description, Action<T1, T2> callback);
public static void RegisterCommand<T1, T2>(string name, string description, string groupName, Action<T1, T2> callback);
 
// Three params
public static void RegisterCommand<T1, T2, T3>(string name, Action<T1, T2, T3> callback);
public static void RegisterCommand<T1, T2, T3>(string name, string description, Action<T1, T2, T3> callback);
public static void RegisterCommand<T1, T2, T3>(string name, string description, string groupName, Action<T1, T2, T3> callback);

Unregister

public static void UnregisterCommand(string name);
public static void UnregisterCommand(string name, string groupName);

Gotchas

  • If the method name doesn't exist on obj, Jahro logs an error and skips registration.
  • All RegisterCommand calls are no-ops when Jahro.Enabled is false — no need to guard them yourself.

Examples

// Bind an Action
Jahro.RegisterCommand("gc-collect", "Maintenance", "Force GC", () => System.GC.Collect());
 
// Bind an Action<T>
Jahro.RegisterCommand<int>("add-lives", "Cheats", "Add lives", amount => Player.Lives += amount);
 
// Bind an object method by name
var ctrl = FindObjectOfType<GameRuntime>();
Jahro.RegisterCommand("restart-level", "Game", "Restart level", ctrl, nameof(GameRuntime.RestartLevel));
 
// Unregister
Jahro.UnregisterCommand("restart-level", "Game");

  • Commands — Text mode parsing, parameter types, and overload resolution
  • Watcher — Watcher mode interface and polling behavior
  • Snapshots — Capturing and sharing debug sessions
  • Jahro Settings — Build configuration, enable/disable per build type
  • Lifecycle — Disabling Jahro in production builds

Last updated: April 1, 2026