gecs-ui-bridge
Installation
SKILL.md
GECS UI Bridge in Godot 4.3+
Connect runtime ECS data (player health, ammo, scores, cooldowns) to Godot Control nodes without tight coupling or spaghetti code. In traditional game development, developers often make the mistake of having UI nodes poll ECS components every frame in _process(), or worse, storing Godot UI nodes inside ECS Component resources.
This skill establishes clean, event-driven bridges using GECS World Events (emit_event) and Reactive Observers (o_*) targeting a decoupled CanvasLayer HUD.
Addon: GECS · version
v9· Godot 4.3+ · MIT
Related skills: gecs-observers for reactive observers, gecs-entities-components for reactive property setters, gecs-core for setup.
1. UI Integration Dilemma: What to Avoid
| Anti-Pattern | Why It Breaks Down | The GECS Solution |
|---|---|---|
| Per-Frame UI Polling | HealthBar._process() calling get_component(C_Health) every frame wastes CPU when HP doesn't change |
Event-Driven: Update only when HP actually mutates |
| Control Nodes in Components | Storing @export var health_bar: ProgressBar in C_Health breaks resource purity & serialization |
Pure Data: Components stay pure data; Observers bridge to UI |
| Direct Entity Lookup in UI | UI reaching deep into the World tree causes tight coupling and breaks when scene reloads | Event Bridge: UI listens to typed signals or World Events |