🧭 Health — UI & Debugging¶
This folder contains UI connectors and optional runtime debugging helpers for the Health system.
These components let you visualise, test, and bind health data to UI
without taking a hard dependency on concrete HealthSystem types. Most tools here
operate on Health interfaces such as IHealthReadonly, IHealthWriter, and IDamageable.
Everything here is: - Interface-driven - Optional - Safe to remove for production - Designed for demos, teaching, debugging, and lightweight UI binding
📦 What UI & Debug Components Are (and Aren’t)¶
They are
- Interface-based bridges to health interfaces (IHealthReadonly, IHealthWriter, IDamageable)
- Runtime helpers for testing and visualisation
- Safe to add/remove at runtime
They are not - Required gameplay systems - Full UI frameworks - Opinionated presentation layers
Use them as references or utilities — not mandatory infrastructure.
🎨 UI Connectors¶
HealthBarUIConnector¶
Namespace: RevGaming.RevFramework.Health.UI.Connectors
Lightweight connector that binds a UnityEngine.UI.Image fill amount
to any IHealthReadonly provider.
Behaviour¶
- Polls health every frame (or
LateUpdate) - Writes
fillImage.fillAmountbased on the provider’sNormalized01 - Auto-resolves a provider if none is assigned
- Safe for pooling and runtime reassignment
Fields¶
| Field | Description |
|---|---|
healthTarget |
Optional explicit target GameObject |
fillImage |
UI Image (Type = Filled, Method = Horizontal) |
autoFindHealth |
Search self → parents → children → scene |
useLateUpdate |
Poll during LateUpdate instead of Update |
debugLogs |
Editor-only helper logging |
Usage¶
- Create a UI Image
- Type: Filled
- Fill Method: Horizontal
- Add
HealthBarUIConnectorto the UI object - Assign the Image to
fillImage - Leave
healthTargetempty for auto-resolution, or assign explicitly
// Assign a new target at runtime
connector.SetTarget(enemy);
// Force immediate refresh
connector.RefreshNow();
Typical Uses¶
- Player health bars
- Enemy HP bars
- Boss UI
- Debug overlays
WorldSpaceHealthBar¶
Namespace: RevGaming.RevFramework.Health.UI.Connectors
Optional world-space health bar helper that reads IHealthReadonly and drives a UI Image.
Behaviour¶
- Updates
fillImage.fillAmountfromIHealthReadonly.Normalized01 - Optional billboarding to face a camera
- Optional distance scaling and colour tinting
This is UI sugar for quick visualisation — real projects can fork or replace it.
🧪 Runtime Debugging (Optional)¶
Some projects include runtime debug panels for inspecting and mutating health via interfaces. If you ship any debug UI in your build, gate it behind build defines or remove it from production.
If you add a debug panel here, it should: - depend on interfaces only (no concrete health types) - clearly label any input bindings (keys/buttons) - be easy to disable or delete for release builds
🧠 Design Notes¶
- UI & debug tools should operate on Health interfaces:
IHealthReadonlyIHealthWriterIDamageable- Avoid dependencies on concrete implementations where possible.
- Clone patterns from these connectors for:
- text counters
- sliders
- gradients
- floating damage numbers
This keeps UI logic cleanly separated from gameplay systems.
❌ What UI & Debug Components Should Not Do¶
- Do not contain gameplay logic
- Do not mutate health outside exposed interfaces
- Do not assume a specific Health implementation
- Do not ship debug panels in production builds
These tools exist to observe and test, not to define gameplay.