unity-composition-pattern

Replace Unity inheritance with ScriptableObject configs and tuple-based ModularEntity data.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

Unity projects often accumulate deep class hierarchies that hinder maintainability; this skill promotes composition over inheritance using ScriptableObject configs and Tuple-based data returns to create flexible, data-driven objects.

Core Features & Use Cases

  • Has-A logic through composable Configs rather than rigid base-class hierarchies.
  • ScriptableObject templates bridge static data to runtime ModularEntity instances.
  • Tuple deconstruction enables multi-part data returns with minimal boilerplate.
  • Hierarchy flattening reduces code surface by moving variations to project assets.

Quick Start

Create a ModularEntity, attach primary and secondary EntityConfigSO assets, and call GetAllData to retrieve runtime data.

Frequently Asked Questions about unity-composition-pattern

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

FAQPage Schema
How do I replace deep class inheritance with composition in Unity?▼

You can replace inheritance with composition in Unity by using ScriptableObject configs and a generic ModularEntity container. This flattens your hierarchy by moving variations to project assets rather than rigid base-classes.

How does a ModularEntity use ScriptableObject templates for runtime data?▼

A ModularEntity uses ScriptableObject templates to bridge static data to runtime instances. You attach primary and secondary EntityConfigSO assets and call GetAllData to retrieve generated runtime data.

When should I flatten my Unity project's class hierarchy?▼

You should flatten your Unity project's class hierarchy when deep base-class structures hinder maintainability. Moving variations to composable ScriptableObject assets reduces code surface and increases flexibility.

Is composition over inheritance suitable for modular Unity game systems?▼

Yes, composition over inheritance is suitable for modular Unity game systems. It applies ScriptableObject-based config assets and tuple-based data returns to create flexible, data-driven objects without rigid dependencies.

Can I return multiple data parts from a Unity component without boilerplate?▼

You can return multi-part data with minimal boilerplate by using tuple deconstruction in your Unity components. Tuple-based data returns allow a ModularEntity pattern to pass multiple values cleanly.

What's the best way to structure composable configs in Unity?▼

The best way to structure composable configs in Unity is using Has-A logic through ScriptableObject assets. This replaces deep inheritance by attaching EntityConfigSO templates to a generic ModularEntity container.