muharremtozan/unity-agent-skills

unity-dependency-injection

Implements Dependency Inversion and Injection patterns. Decouples high-level logic from concrete implementations using attributes and reflection.

First seen Apr 19, 2026

Installation

$ npx skills add muharremtozan/unity-agent-skills --skill unity-dependency-injection

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,588 B
  • docs SUMMARY.md 179 B

History

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

SKILL.md

Unity Dependency Injection (DI)

A lightweight system to satisfy the "D" in SOLID. Allows classes to request dependencies via [Inject] without knowing who provides them.

Core Features

  1. Attribute-Based Injection: Use [Inject] to mark fields and [Provide] to define sources.
  2. Interface Focus: Encourages programming to abstractions, making systems hot-swappable.
  3. Automated Wiring: Scene-wide injection happens on Awake, ensuring dependencies are ready before Start.
  4. Diagnostic Logging: Tracks successful injections and warns about missing providers.

Core Files (Max 3)

  • DIAttributes.cs.txt: Contains the marker attributes for the compiler.
  • DependencyInjector.cs.txt: The engine that finds and wires dependencies in the scene.
  • DIExample.cs.txt: Shows how to decouple a Hero from an AbilitySystem.

Usage

1. Define an Interface

public interface IWeapon { void Fire(); }

2. Provide the Implementation

public class PlasmaRifle : MonoBehaviour, IWeapon {
    [Provide] public IWeapon GetWeapon() => this;
    public void Fire() { /* ... */ }
}

3. Inject into Client

public class Player : MonoBehaviour {
    [Inject] private IWeapon currentWeapon;
    void Start() => currentWeapon.Fire();
}

4. Setup

Place a DependencyInjector component in your scene or persistent prefab.