CubeDI is a modern dependency injection (IoC) container for Unity, built to be small, fast and genuinely easy to use.
Why CubeDI?
Dependency injection shouldn't require a 300-page manual or a heavyweight framework. Zenject is powerful but bloated; VContainer is lean but under-documented. CubeDI hits the sweet spot: a tiny, readable API you can learn in an afternoon, backed by a resolver that stays out of your way at runtime.
Built for real projects
- One clear entry point: SceneContext per scene, GlobalContext auto-loaded across scenes (no bootstrap scene needed).
- Constructor, method, field and property injection - use whichever fits.
- Real keyed (tagged) bindings, multi-binding, and nested child containers.
- A clean lifecycle: Initialize, Tick / FixedTick / LateTick, and deterministic Dispose.
- Prefab instantiation with dependencies injected before Awake.
- Zero-allocation injection at runtime - no GC hitches during gameplay.
- No hidden global state - safe with disabled Domain Reload and fast Play Mode enter.
- IL2CPP / AOT friendly. No code generation required to ship.
See it, don't guess it
CubeDI ships with a live Dependency Graph window (Window > CubeDI > Dependency Graph): inspect every context and binding, and catch missing dependencies and constructor cycles before they ever throw at runtime. Nothing like it comes built into Zenject or VContainer.
Everything is plain C#, fully commented, and shipped with complete source code - no DLLs, no black boxes. Read it, tweak it, own it.
Roadmap
- Optional source generator for zero-reflection injection on AOT platforms.
Support
Questions, bugs or feature requests? Reach out at alex.max5568@gmail.com or on Discord grandmax1 - fast replies.