What problem does it solve?
VContainer solves brittle Unity coupling by providing a lightweight dependency injection approach that keeps components loosely connected and easier to test.
Core Features & Use Cases
- Hierarchical scoping: Compose dependencies with a parent-child
LifetimeScope structure so scene-specific services can override project-wide services safely.
- Constructor + method injection: Use constructor injection for plain C# classes and
[Inject] method injection for MonoBehaviour components to keep dependencies explicit.
- Configurable composition: Register interfaces to implementations, register instances like
ScriptableObject data, and create runtime objects via factories and entry points for consistent lifecycles.
- Use Case: In a Unity game, register shared services (audio/save/analytics) at a root scope, register per-scene systems (score/spawn/UI) in scene scopes, and inject them into controllers without manual wiring across dozens of scripts.
Quick Start
Use the vcontainer skill to configure a RootLifetimeScope and a scene LifetimeScope, then register your services and controllers so dependencies are resolved automatically across scopes.