API Reference
This is a practical reference for Jahro's Unity API, focusing on the most commonly used attributes and runtime methods. Keep this open while you work for quick access to method signatures and examples.
Attributes
JahroCommand
Mark a method as a console command that can be executed from the Jahro interface.
[JahroCommand()] // no args
[JahroCommand(string name)] // name only
[JahroCommand(string name, string group)] // name + group
[JahroCommand(string name, string group, string description)]Parameters:
- name: Unique command identifier. If omitted, method name is used. Spaces are automatically removed.
- group: Visual grouping for organization. Defaults to "Default".
- description: Shown in Visual mode for user guidance.
Usage example:
using JahroConsole;
using UnityEngine;
public class Cheats : MonoBehaviour
{
[JahroCommand("add-gold", "Cheats", "Add gold to the player")]
public void AddGold(int amount) { /* ... */ }
[JahroCommand] // "Ping"
public void Ping() { Debug.Log("pong"); }
}Notes:
- Static and instance methods are supported. For instance methods, register the object with
Jahro.RegisterObject. - Overloads are supported; Text mode resolves parameters using intelligent mapping rules.
Read more: Unity Commands
JahroWatch
Mark a field or property to appear in Watcher mode for real-time monitoring.
[JahroWatch()] // no args
[JahroWatch(string name)] // name
[JahroWatch(string name, string group)] // name + group
[JahroWatch(string name, string group, string description)]Parameters:
- name: Display name in the Watcher interface. Defaults to member name with leading
_stripped. - group: Visual grouping for organization. Defaults to "Default".
- description: Shown in the details modal for additional context.
Usage 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;
}Notes:
- Works on static and instance members. Register instances so Jahro can read values.
- Values are only read when Watcher mode is active for optimal performance.
Read more: Unity Watcher
Namespaces and assemblies
- Namespace:
JahroConsole - Assemblies:
- Runtime:
Assets/JahroPackage/Runtime/... - Editor:
Assets/JahroPackage/Editor/...
- Runtime:
Runtime API: Jahro
Main static entry point: JahroConsole.Jahro.
State and lifecycle
public static bool Enabled { get; } // True if Jahro is enabled (Jahro Settings)
public static bool IsOpen { get; } // True if console window is shown
public static bool IsReleased { get; } // True after Release() was called
[RuntimeInitializeOnLoadMethod]
public static void InitializeIfNeeded(); // Auto-invoked
public static void Release(); // Flushes and disposes Jahro (e.g., on assembly reload)Events:
public static UnityEngine.Events.UnityAction OnConsoleShow; // Fired when window is shown
public static UnityEngine.Events.UnityAction OnConsoleHide; // Fired when window is closedNotes:
Enabledreflects settings fromTools/Jahro Settings. It can auto-disable on non-development builds.
View control
public static void ShowConsoleView(); // Show Jahro window
public static void CloseConsoleView(); // Hide Jahro windowLaunch button:
public static void EnableLaunchButton();
public static void DisableLaunchButton();
public static void ShowLaunchButton();
public static void HideLaunchButton();Properties:
public static bool IsLaunchButtonEnabled { get; } // Whether launch button feature is enabledNotes:
- The launch button is draggable and its position is automatically saved.
Object registration (Watcher + instance commands)
public static void RegisterObject(object obj); // Scan for [JahroWatch] and [JahroCommand] on instance
public static void UnregisterObject(object obj); // Remove all watchers/commands for that instanceUsage:
void OnEnable() => Jahro.RegisterObject(this);
void OnDisable() => Jahro.UnregisterObject(this);Notes:
- Passing
nulllogs an error and does nothing. - Always unregister objects to prevent memory leaks.
Commands — dynamic registration
Bind an instance method by name:
public static void RegisterCommand(
string name,
string description,
string groupName,
object obj,
string methodName
);Overloads (convenience):
public static void RegisterCommand(string name, object obj, string methodName);
public static void RegisterCommand(string name, string description, object obj, string methodName);Register delegates:
// No params
public static void RegisterCommand(string name, System.Action callback);
public static void RegisterCommand(string name, string description, System.Action callback);
public static void RegisterCommand(string name, string description, string groupName, System.Action callback);
// One param
public static void RegisterCommand<T>(string name, System.Action<T> callback);
public static void RegisterCommand<T>(string name, string description, System.Action<T> callback);
public static void RegisterCommand<T>(string name, string description, string groupName, System.Action<T> callback);
// Two params
public static void RegisterCommand<T1,T2>(string name, System.Action<T1,T2> callback);
public static void RegisterCommand<T1,T2>(string name, string description, System.Action<T1,T2> callback);
public static void RegisterCommand<T1,T2>(string name, string description, string groupName, System.Action<T1,T2> callback);
// Three params
public static void RegisterCommand<T1,T2,T3>(string name, System.Action<T1,T2,T3> callback);
public static void RegisterCommand<T1,T2,T3>(string name, string description, System.Action<T1,T2,T3> callback);
public static void RegisterCommand<T1,T2,T3>(string name, string description, string groupName, System.Action<T1,T2,T3> callback);Unregister:
public static void UnregisterCommand(string name);
public static void UnregisterCommand(string name, string groupName);Notes:
- If the method doesn't exist on
obj, an error is logged and the command is not added. - All registrations honor
descriptionandgroupName. - If Jahro is not
Enabled, registration calls are no-ops.
Quick examples
Register an Action:
Jahro.RegisterCommand("gc-collect", "Maintenance", "Force GC", () => System.GC.Collect());Register an Action<T>:
Jahro.RegisterCommand<int>("add-lives", "Cheats", "Add lives", amount => Player.Lives += amount);Bind to object method:
var ctrl = FindObjectOfType<GameRuntime>();
Jahro.RegisterCommand("restart-level", "Game", "Restart", ctrl, nameof(GameRuntime.RestartLevel));Unregister:
Jahro.UnregisterCommand("restart-level", "Game");Next Steps
Explore more Jahro features to build a complete debugging workflow:
- Snapshots - Sync logs and screenshots with your team
- Commands - Create debug commands that output custom logs
- Watcher - Monitor live variables for real-time debugging
For advanced configuration, check out Jahro Settings and learn about disabling Jahro in production builds.