A lightweight Unity dependency injection framework with direct, indirect, and collider-based injection for scalable, clean, and modular gameplay systems.Additional Compatibility Information: Haystack Core Dependency Injection is compatible with Unity’s Scriptable Render Pipelines (SRP), including HDRP, URP, and the built-in pipeline. It integrates seamlessly with any of these pipelines, ensuring smooth functionality across different rendering setups.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 codeDirect and indirect injection systems for flexible workflowsCollider and Collider2D injection for gameplay interactionsManual binding and resolving for lightweight container controlRuntime configuration settings for performance and behavior tuningDebug-friendly tools such as TryResolve, unbinding, and validation helpersSupport for both singleton and transient dependency lifetimesHaystack 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.Attribute-based dependency injection system ([Inject], [Install], etc.)Direct injection for scene-based objectsIndirect injection with custom key support for runtime systemsCollider and Collider2D injection for gameplay interactions (trigger, collision, overlap)Manual binding and resolving (Bind, Resolve, TryResolve, ResolveAll)Support for singleton and transient lifetimes via factory bindingsStatic dependency injection supportLightweight container-style architecture (no heavy setup required)Runtime configuration system for execution control and safetyCoroutine-based initialization (WebGL-friendly, no async dependency issues)Debug and validation tools (TryResolve, IsBound, verbose logs)Dependency unbinding system (including UnbindAfterInjection behavior)Runtime refresh and reset system (Haystack.Refresh, Haystack.Reset)Support for inactive object injection and delayed executionCross-platform compatibility (Desktop, Mobile, WebGL)Editor tools and configuration assets includedDemo scenes and sample scripts includedBackward compatibility with legacy attribute aliasesAI tools were used as a development assistant during the creation of this package. The core concept, architecture, and initial foundation of this tool were originally designed and implemented manually by the author without AI.AI (such as code assistants) was later utilized to help with:Refining and optimizing complex logic systemsAssisting in solving difficult technical problemsDebugging and fixing edge-case issuesImproving code structure and maintainabilityAll final implementations, decisions, and validations were reviewed and controlled by the author to ensure quality, performance, and correctness.



