DI: Dependency Injector's icon

DI: Dependency Injector 1.0.0 Scripts 4.0 Community

Submitted by user adam_saudagar; MIT; 2025-01-21

This script provides a Dependency Injection (DI) system for the Godot Engine. It facilitates object creation, dependency management, and binding using various modes (singleton, instance, value, etc.). With this script, you can manage your dependencies more efficiently, especially for large-scale Godot projects.

---

## Features

- **Dependency Injection**: Inject dependencies into nodes dynamically or throughout the scene tree.
- **Binding System**: Bind classes, interfaces, variables, and scenes to be used as dependencies.
- **Flexible Binding Modes**:
- `INSTANCE`: Creates a new instance every time.
- `SINGLETON`: A single shared instance for the class.
- `SCENE_INSTANCE`: Creates an instance of a scene.
- `SCENE_SINGLETON`: A single shared instance of a scene.
- `VALUE`: Directly binds a value.
- `ALL_MAPPED`: Retrieves all mapped dependencies for an interface.
- **Scene Parent Management**: Automatically assigns default parent nodes for created scenes when no parent is specified.
- **Recursive Tree Injection**: Injects dependencies recursively into the scene tree.
- **Interface Mapping**: Supports mapping dependencies to enums for fine-grained control.


View files Download Submit an issue Recent Edits