vcontainer

Resolve Unity dependencies with VContainer lifetimes and injections.

3|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/XeldarAlz/KlondikeSolitaire --skill vcontainer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vcontainer
Source: https://github.com/XeldarAlz/KlondikeSolitaire/tree/main/.claude/skills/third-party/vcontainer
Command: npx skills add https://github.com/XeldarAlz/KlondikeSolitaire --skill vcontainer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

VContainer provides a lightweight dependency injection framework for Unity, enabling clean wiring of services, lifetime management, and decoupled components to improve testability and maintainability.

Core Features & Use Cases

  • Plain C# constructor injection for non-MonoBehaviour classes and scriptable objects
  • MonoBehaviour integration via [Inject] methods and component registrations
  • LifetimeScope hierarchy with singleton, scoped, and transient lifetimes across scenes
  • Factory and registration patterns to compose complex object graphs without service locators
  • Real-world use: structuring game systems (audio, UI, gameplay) behind interfaces to simplify testing and iteration

Quick Start

Instantiate and wire Unity objects with VContainer to automatically resolve dependencies and manage lifetimes across scenes.

Frequently Asked Questions about vcontainer

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

FAQPage Schema
How do I set up dependency injection for MonoBehaviour scripts in Unity?

VContainer supports MonoBehaviour dependency injection by using the [Inject] attribute on methods, allowing Unity components to automatically resolve registered services without relying on service locators.

What is the best way to manage scene-scoped services across Unity scenes?

Using a LifetimeScope hierarchy is the best way to manage scene-scoped services in Unity. VContainer uses these hierarchies to define singleton, scoped, and transient lifetimes for clean dependency resolution across scene transitions.

Can I use constructor injection for plain C# classes in Unity without MonoBehaviours?

Yes, VContainer fully supports plain C# constructor injection for non-MonoBehaviour classes and scriptable objects. This allows you to resolve dependencies automatically during instantiation to compose complex object graphs without service locators.

Does VContainer support factory and registration patterns for complex object graphs?

VContainer supports factory and registration patterns to compose complex object graphs without service locators. This allows you to instantiate and wire Unity objects dynamically, ensuring dependencies are resolved cleanly for testable architectures.

Why use a lightweight DI framework over a service locator in Unity game architecture?

Using a lightweight DI framework instead of a service locator improves testability and maintainability by decoupling components. Structuring game systems like audio and UI behind interfaces simplifies iteration and avoids hidden dependencies in your architecture.

When do I need LifetimeScope hierarchies in Unity dependency injection?

You need LifetimeScope hierarchies when managing dependencies across multiple scenes or complex architectures. They provide scene-scoped services and manage singleton, scoped, and transient lifetimes to ensure objects are instantiated and disposed correctly within defined boundaries.