tools-unity-vcontainer

Automate VContainer dependency injection setup for Unity projects.

6|1|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/tjboudreaux/cc-plugin-unity-gamedev --skill tools-unity-vcontainer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tools-unity-vcontainer
Source: https://github.com/tjboudreaux/cc-plugin-unity-gamedev/tree/main/skills/tools-unity-vcontainer
Command: npx skills add https://github.com/tjboudreaux/cc-plugin-unity-gamedev --skill tools-unity-vcontainer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

VContainer provides a structured dependency injection (DI) approach for Unity projects, enabling explicit lifetimes, scopes, and testable code by centralizing object creation and resolution.

Core Features & Use Cases

  • Lifetime management through Singleton, Scoped, and Transient patterns, with guidance on avoiding cross-scope leaks.
  • Registration patterns including basic, instance, factory, and entry point registrations to compose decoupled systems.
  • Injection patterns such as constructor, method, and (optionally) property injection to wire dependencies cleanly.
  • Scoped containers and child scopes for feature isolation, with examples of installers and segment loading patterns.
  • Common crash fixes and safe resolution practices, including TryResolve and scope-alive checks.
  • Testing strategies with DI in Unity, including unit tests and installer validation.
  • Editor cleanup considerations to prevent DI-related issues during Play mode.

Quick Start

Configure a LifetimeScope, register services with Singleton lifetimes, and resolve dependencies via constructors to begin using VContainer in Unity.

Frequently Asked Questions about tools-unity-vcontainer

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

FAQPage Schema
How do I set up dependency injection in Unity using VContainer?▼

To set up dependency injection in Unity with VContainer, configure a LifetimeScope, register services using Singleton lifetimes, and resolve dependencies via constructors to compose decoupled systems across scenes.

What is the best way to manage service lifetimes and scopes in Unity?▼

Service lifetimes and scopes in Unity are managed using Singleton, Scoped, and Transient patterns, utilizing child scopes and installers for feature isolation to prevent cross-scope leaks and ensure safe resolution.

Can I use constructor and method injection to wire dependencies cleanly in Unity?▼

Yes, you can use constructor, method, and optionally property injection to wire dependencies cleanly in Unity, centralizing object creation and resolution for explicit lifetimes and testable code.

How do I fix common crashes and ensure safe resolution during dependency injection?▼

Fix common dependency injection crashes by using TryResolve and scope-alive checks for safe resolution, ensuring scoped containers remain valid and preventing resolution failures during runtime.

What testing strategies work with dependency injection for Unity components?▼

Testing strategies for dependency injection in Unity include writing unit tests and performing installer validation to verify scoped services and testable components function correctly across isolated scenes.

Why do I need to handle editor cleanup for dependency injection during Play mode?▼

Editor cleanup is necessary to prevent dependency injection-related issues during Play mode, ensuring scoped containers and registered services reset correctly to avoid cross-scope leaks and unexpected crashes.