vcontainer

Structure Unity dependency injection with VContainer LifetimeScope composition roots.

3|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/OmerZeyveli/kinglet-unity --skill vcontainer-omerzeyveli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vcontainer
Source: https://github.com/OmerZeyveli/kinglet-unity/tree/main/.claude/skills/third-party/vcontainer
Command: npx skills add https://github.com/OmerZeyveli/kinglet-unity --skill vcontainer-omerzeyveli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Unity developers structure dependency injection without tightly coupling gameplay systems, services, and scene components to concrete implementations or global singletons.

Core Features & Use Cases

  • LifetimeScope Architecture: Organize project-wide, scene-specific, and runtime child scopes with clear dependency boundaries.
  • Injection Patterns: Apply constructor injection for plain C# classes, method injection for MonoBehaviours, and lifecycle entry points for services that need startup, update, or disposal behavior.
  • Registration Guidance: Configure interface bindings, component registration, factories, ScriptableObject instances, and appropriate singleton, scoped, and transient lifetimes.
  • Testing and Reliability: Improve testability, avoid circular dependencies, validate registrations, and prevent common Unity DI mistakes.
  • Use Case: Use the Skill to design a game scene scope that injects audio, input, scoring, configuration, and player components while keeping shared services in a root scope.

Quick Start

Use the vcontainer skill to design and register a Unity 6 game scene's LifetimeScope with constructor injection for services and method injection for MonoBehaviours.

Frequently Asked Questions about vcontainer

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

FAQPage Schema
How do I structure dependency injection in Unity without using global singletons?

You can structure dependency injection in Unity by using VContainer LifetimeScope composition roots to define project-wide, scene-specific, and runtime child scopes with clear dependency boundaries.

What is the correct way to inject dependencies into MonoBehaviours using VContainer?

For VContainer dependency injection, apply constructor injection for plain C# classes and method injection for MonoBehaviours to properly wire services and gameplay components without tight coupling.

How do I configure parent-child scope resolution for a Unity game scene?

Configure parent-child scope resolution by organizing shared services in a root LifetimeScope and injecting scene-specific components like audio, input, and scoring into a child game scene scope.

When should I use singleton, scoped, or transient lifetimes in Unity dependency injection?

Select singleton, scoped, or transient lifetimes during dependency registration based on whether services need persistent state, scene-level isolation, or transient instances for runtime factory creation.

Does VContainer support unit testing for Unity dependency injection graphs?

VContainer supports unit testing by improving testability through interface bindings and explicit dependency registration, allowing you to validate dependency graphs and avoid circular dependencies.

What are common Unity DI mistakes when wiring MonoBehaviour entry points?

Common Unity DI mistakes include creating circular dependencies, misconfiguring lifecycle entry points for startup and disposal, and failing to validate dependency registrations across LifetimeScope boundaries.