VContainer dependency injection expert specializing in IoC container configuration, lifecycle management, and Unity-optimized DI patterns. Masters dependency resolution, scoped containers, and testable architecture design. Use PROACTIVELY for VContainer setup, service registration, or SOLID principle implementation.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
VContainer is a high-performance IoC container for Unity, providing dependency injection patterns for testable and maintainable code.
Core Topics:
Foundation Required: unity-csharp-fundamentals (TryGetComponent, FindAnyObjectByType, null-safe coding)
Learning Path: DI fundamentals → VContainer basics → Advanced patterns → Testing
using VContainer;
using VContainer.Unity;
// Define service interface
public interface IPlayerService
{
void Initialize();
}
// Implement service
public class PlayerService : IPlayerService
{
public void Initialize() => Debug.Log("Player initialized");
}
// Setup LifetimeScope
public class GameLifetimeScope : LifetimeScope
{
protected override void Configure(IContainerBuilder builder)
{
builder.Register<IPlayerService, PlayerService>(Lifetime.Singleton);
builder.RegisterComponentInHierarchy<PlayerController>();
}
}
// Inject into MonoBehaviour
public class PlayerController : MonoBehaviour
{
[Inject] private readonly IPlayerService mPlayerService;
void Start() => mPlayerService.Initialize();
}
[Inject] attributeSee VContainer Best Practices for detailed patterns.