unity-observer-pattern
Installation
SKILL.md
Unity Observer Pattern (Reactive Properties)
A powerful implementation of the Observer pattern that turns standard variables into "Smart Properties." Includes full Inspector support and Edit-mode tooling based on the "Generic Observer" architecture.
Core Features
- Hybrid Path: Works with standard C# listeners (Pro Path) AND UnityEvents (Designer/Light Path).
- Implicit Casting: Seamless syntax allows
int x = myObservableInt;(no more.Valueboilerplate). - Editor Persistence: Programmatically wire persistent calls in Edit Mode that save to scene/prefab.
- Diagnostic Logging: Built-in structured logging for tracking event flows.
Core Files (Max 3)
Observable.cs.txt: The core generic wrapper with implicit casting and built-in editor wiring.ObservableEditorTools.cs.txt: Advanced reflection hacks for clearing persistent UnityEvents.ObservableExample.cs.txt: Concrete example demonstrating UI binding and lifecycle management.