unity-visitor-pattern

Apply operations to Unity components via IVisitable and IVisitor contracts.

Updated Feb 13, 2026
One-click install
npx skills add https://github.com/MuharremTozan/Ohm-Yura --skill unity-visitor-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-visitor-pattern
Source: https://github.com/MuharremTozan/Ohm-Yura/tree/main/.agents/skills/unity-visitor-pattern
Command: npx skills add https://github.com/MuharremTozan/Ohm-Yura --skill unity-visitor-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Decouples operations on Unity components by applying external logic without modifying their core classes, enabling clean stat modifications and power-ups while reducing logic leakage.

Core Features & Use Cases

  • Double Dispatch: Route operations to the correct component types at runtime.
  • Scriptable Visitors: Create data-driven visitors that designers can configure in the Inspector.
  • Decoupled Logic: Keep game components free from direct logic responsibility, enabling reusable operations across multiple types.

Quick Start

Create a VisitableComponent, implement a ScriptableVisitor, and trigger visitation through a VisitorTrigger to apply power-ups at runtime.

Frequently Asked Questions about unity-visitor-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply stat modifications to Unity components without altering their classes?

You can apply stat modifications without altering classes by using the Visitor pattern to decouple external logic. This framework routes operations to the correct component types at runtime, keeping game components free from direct logic responsibility.

What is the Visitor pattern used for in Unity game development?

In Unity game development, the Visitor pattern provides a robust framework for applying operations across components without modifying their core classes. It enables decoupled behavior across multiple component types, such as applying power-ups or modifying stats.

How do I create data-driven power-ups that designers can configure in the Unity Inspector?

You create data-driven power-ups by implementing ScriptableVisitor abstractions as ScriptableObject-powered visitors. This allows designers to configure operations and modifiers directly in the Inspector without altering core component code.

Does this Visitor pattern framework require specific dependencies to work in Unity?

No, this Visitor pattern framework requires no external dependencies. It operates using native Unity components and ScriptableObjects, defining IVisitable and IVisitor contracts along with ScriptableVisitor and VisitableComponent abstractions.

What is the best way to decouple power-up logic from game components in Unity?

The best way to decouple power-up logic is using a pattern-driven framework with double dispatch. It routes operations to the correct component types at runtime through external visitors, reducing logic leakage inside the game components.