Analyzes C# fields and properties and generates [JahroWatch] attributes with groups and performance-safe patterns. Use when the user wants to monitor variables at runtime, add watchers, track game state, replace Debug.Log polling, or mentions JahroWatch, real-time inspection, or variable monitoring.
94
92%
Does it follow best practices?
Impact
98%
1.19xAverage score across 3 eval scenarios
Passed
No known issues
Help users monitor game variables in real-time using Jahro's [JahroWatch] attribute system.
[JahroWatch] attributesRegisterObject)When the user shares a class, identify members worth monitoring:
Good candidates:
Skip these:
Suggest replacing Debug.Log polling:
If the user has Debug.Log($"Health: {health}") in Update(), recommend [JahroWatch] instead — it eliminates log spam and provides a clean real-time dashboard.
[JahroWatch("Display Name", "GroupName", "Description for detail modal")]Constructor: [JahroWatch(string name, string group, string description)]
All parameters are optional. Defaults: name = member name (leading _ stripped), group = "Default", description = "".
using JahroConsole;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
[JahroWatch("Health", "Player", "Current hit points")]
public float health = 100f;
[JahroWatch("Stamina", "Player", "Current stamina")]
public float stamina = 50f;
[JahroWatch("Position", "Player", "World position")]
public Vector3 Position => transform.position;
[JahroWatch("Velocity", "Player", "Movement velocity")]
public Vector3 Velocity => GetComponent<Rigidbody>().velocity;
[JahroWatch("Is Grounded", "Player", "Touching ground")]
public bool isGrounded;
void OnEnable() => Jahro.RegisterObject(this);
void OnDisable() => Jahro.UnregisterObject(this);
}void OnEnable() => Jahro.RegisterObject(this);
void OnDisable() => Jahro.UnregisterObject(this);This same call also registers [JahroCommand] attributes on the class. If the class already has RegisterObject for commands, do not add a second call — one call handles both.
Read references/common-patterns.md for the canonical lifecycle pattern.
Static fields and properties with [JahroWatch] are discovered via assembly scanning:
public static class GameStats
{
[JahroWatch("Total Score", "Game")]
public static int Score;
[JahroWatch("Session Time", "Game")]
public static float SessionTime => Time.realtimeSinceStartup;
}If the class already has [JahroCommand] attributes and RegisterObject, just add [JahroWatch] attributes — no registration changes:
public class GameManager : MonoBehaviour
{
// Existing command
[JahroCommand("reset-game", "Game", "Reset game")]
public void ResetGame() { /* ... */ }
// New watchers — just add attributes
[JahroWatch("Player Count", "Game")]
public int playerCount;
[JahroWatch("Game Time", "Game")]
public float gameTime;
// Already present — no changes needed
void OnEnable() => Jahro.RegisterObject(this);
void OnDisable() => Jahro.UnregisterObject(this);
}| Type | List View Display | Detail Modal |
|---|---|---|
int, float, double, bool | Value as-is | Same |
string | Truncated | Full text |
Vector2 | Compact coords | Coords + magnitude |
Vector3 | Compact coords | Coords + magnitude |
Quaternion | Raw values | Raw + Euler angles |
Transform | Position | Position, rotation, scale, child count |
Rigidbody | Summary | Mass, kinematic, gravity, velocity, angular velocity |
Collider | Summary | Trigger status, material, bounds |
AudioSource | Summary | Clip, volume, loop, pitch, mute |
Camera | Summary | FOV, clip planes, aspect ratio |
Arrays (any T[]) | TypeName[length] | Full contents |
For custom types not in this table, the watcher calls .ToString(). If you need rich display, consider watching individual primitive properties instead.
Read references/api-reference.md for the full type display details.
Watchers are designed to be safe for development and testing:
JAHRO_DISABLE or auto-disable, watchers are never evaluated.public int Count => expensiveList.Where(...).Count() runs its getter every frame the Watcher is open. Cache expensive computations.private float _cachedFps;
private float _lastFpsUpdate;
void Update()
{
if (Time.time - _lastFpsUpdate > 0.25f)
{
_cachedFps = 1f / Time.unscaledDeltaTime;
_lastFpsUpdate = Time.time;
}
}
[JahroWatch("FPS", "Performance")]
public float FPS => _cachedFps;"Player" — Health, Stamina, Position, Velocity
"Physics" — Is Grounded, Angular Velocity, Collision Count
"Performance" — FPS, Memory, Draw Calls
"Game" — Game State, Level Progress, Player Count
"AI" — AI State, Target, Path Length"Critical" — Health, Frame Time (always need these)
"Gameplay" — Enemy Count, Spawn Timer
"Diagnostics" — GC Allocs, Memory| Pattern in code | Suggestion |
|---|---|
Debug.Log in Update() logging variable values | Replace with [JahroWatch] — cleaner, no log spam |
[JahroWatch] already present | Suggest additional watchers, better groups, performance tips |
[JahroCommand] but no watchers | Suggest adding watchers for key state the commands modify |
| Rigidbody or physics-heavy code | Suggest velocity, angular velocity, isGrounded watchers |
| Game manager with state fields | Suggest watching game state enum, counts, timers |
After generating watchers, always include:
Verify: Enter Play Mode → press ~ → switch to the Watcher tab. Confirm your watched values appear in the correct groups and update in real-time as the game runs. Tap a watcher to see its detail modal.
If watchers appear but don't update, or don't appear at all, suggest the jahro-troubleshooting skill — common causes: missing RegisterObject, Watcher tab not open, object destroyed without unregistering.
300b45d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.