unity-mvc-pattern
Implementation of Model-View-Controller (MVC) and Model-View-Presenter (MVP) patterns in Unity. Focuses on Separation of Concerns for scalable UI and game systems.
How do I install this agent skill?
npx skills add https://github.com/muharremtozan/unity-agent-skills --skill unity-mvc-patternIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides standard C# implementation patterns for Unity game development (MVC/MVP). It contains purely educational content and boilerplate code with no security risks or malicious behaviors detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Unity MVC / MVP Pattern
This skill implements the architectural principle of "Separation of Concerns." It divides your code into three distinct layers: Model (Data), View (Visuals), and Presenter (Logic bridge).
Core Features
- ObservableList: A reactive collection that notifies listeners (the View) when data changes.
- Passive View: Views are MonoBehaviours that only care about HOW to display data, not WHERE it comes from.
- Mediated Logic: The Presenter handles the "Wiring" and lifecycle, keeping Data and Visuals completely decoupled.
- MMO Hotbar Pattern: A concrete implementation of the multi-slot observable layout described in the reference text.
Core Files (Max 3)
ObservableList.cs.txt: Generic collection wrapper with structural change notifications.GenericPresenter.cs.txt: Base class for creating M-V-P relationships without boilerplate.MMOHotbarExample.cs.txt: Practical application showing data flowing from a Model to a UI view.
Usage
1. The Model (Data)
Contains your state using Observable<T> or ObservableList<T>. It does not know about Unity UI.
2. The View (Visuals)
A MonoBehaviour that exposes public methods for updating its state (e.g., SetHealth(float val)).
3. The Presenter (Bridge)
public class MyPresenter : Presenter<MyModel, MyView> {
protected override void Bind() {
model.health.OnChanged += view.SetHealth;
}
}
When to Use
Use this pattern for complex UI (Inventories, Skill Trees, Settings) or high-level game managers where logic and visuals are likely to change independently.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/muharremtozan/unity-agent-skills/unity-mvc-pattern">View unity-mvc-pattern on skillZs</a>