muharremtozan/unity-agent-skills55 installs
unity-dependency-injection
Implements Dependency Inversion and Injection patterns. Decouples high-level logic from concrete implementations using attributes and reflection.
How do I install this agent skill?
npx skills add https://github.com/muharremtozan/unity-agent-skills --skill unity-dependency-injectionIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides a standard implementation of a Dependency Injection system for Unity using C# reflection. No security risks were identified.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
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
- Attribute-Based Injection: Use
[Inject]to mark fields and[Provide]to define sources. - Interface Focus: Encourages programming to abstractions, making systems hot-swappable.
- Automated Wiring: Scene-wide injection happens on Awake, ensuring dependencies are ready before Start.
- 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.
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-dependency-injection">View unity-dependency-injection on skillZs</a>