Haystack (DI) Lite


A lightweight Unity dependency injection framework with direct, indirect, and collider-based injection for scalable, clean, and modular gameplay systems.


by Reckdev


Price History +

Haystack is a lightweight and flexible dependency injection framework designed for Unity developers who want cleaner architecture, better scalability, and faster development workflows. It provides a simple yet powerful way to manage dependencies across gameplay systems without heavy setup or complex configurations.

The framework supports multiple injection approaches including direct injection for scene-based objects, indirect injection for runtime and dynamic systems, and collider-based injection for interaction-driven mechanics such as triggers, pickups, and combat systems. This makes it highly adaptable for different types of projects, from small prototypes to large-scale games.

Haystack is built with performance and platform compatibility in mind, ensuring stable behavior across desktop, mobile, and WebGL builds. It avoids common issues related to async workflows by supporting coroutine-based initialization, making it especially suitable for WebGL environments.

Developers can use attributes to define dependencies clearly, reducing tight coupling and improving code readability and maintainability. The framework also includes manual binding and resolving options, allowing a lightweight container-style workflow for advanced use cases.

Key features include:

  • Attribute-based dependency injection for clean and organized code
  • Direct and indirect injection systems for flexible workflows
  • Collider and Collider2D injection for gameplay interactions
  • Manual binding and resolving for lightweight container control
  • Runtime configuration settings for performance and behavior tuning
  • Debug-friendly tools such as TryResolve, unbinding, and validation helpers
  • Support for both singleton and transient dependency lifetimes

Haystack is suitable for any game genre, including multiplayer, simulation, RPG, FPS, and mobile games. It is designed to scale with your project while remaining easy to use for both beginners and experienced developers.

The package includes runtime systems, editor tools, configuration assets, and demo examples to help you get started quickly.