muharremtozan/unity-agent-skills

unity-observer-pattern

Reactive Property system for Unity. Decouples data from UI and logic using observable wrappers and UnityEvents.

First seen Apr 19, 2026

Installation

$ npx skills add muharremtozan/unity-agent-skills --skill unity-observer-pattern

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from muharremtozan/unity-agent-skills · top by installs.

npx skills add muharremtozan/unity-agent-skills

Browse all from muharremtozan/unity-agent-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 13
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,694 B
  • docs SUMMARY.md 141 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 45 installs

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

  1. Hybrid Path: Works with standard C# listeners (Pro Path) AND UnityEvents (Designer/Light Path).
  2. Implicit Casting: Seamless syntax allows int x = myObservableInt; (no more .Value boilerplate).
  3. Editor Persistence: Programmatically wire persistent calls in Edit Mode that save to scene/prefab.
  4. 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.

Usage

Option A: The Light Path (Inspector)

  1. Define a field: public Observable<int> health;.
  2. In Unity Inspector, drag your UI method into the On Value Changed list.

Option B: The Pro Path (Code)

health.AddListener( val => Debug.Log( val ) );
health.Value = 50; // Automatically triggers notification

Option C: Implicit Usage

int currentHealth = health; // Works automatically via implicit operator

Cleanup

Always call RemoveListener or Dispose in OnDisable to prevent memory leaks.