Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Simple Dependency Injection

An asset by comfygrapes
The page banner background of a mountain and forest
Simple Dependency Injection hero image

Quick Information

0 ratings
Simple Dependency Injection icon image
comfygrapes
Simple Dependency Injection

Easily add Dependency Injection into your project.When the plugin is enabled, it will automatically create the necessary nodes in your current scene (preferably your Main). Simply add your node dependencies to the array in the [DependencyRegistrar] node and the [DependencyProvider] node will do the rest!To allow dependency injection to happen in any script attached to a node in the scene tree, simply create either an _inject function or a _post_inject function, or both! But do keep in mind that these are only called after _ready.This tool is useful in cases where:1. You do not have direct access (via @export) to the nodes you need in a script and do not wish to create a global singleton via autoload.2. You want a form of dependency inversion and wish to rely on abstractions to interact with other parts of your code.3. The nodes you need have their own in-scene dependencies that they need to have direct access (via @export) to.

Supported Engine Version
4.4
Version String
1.0.2
License Version
MIT
Support Level
community
Modified Date
12 hours ago
Git URL
Issue URL

dependency-injection-system

A simple DI implementation for Godot 4 made with GDScript.

Easily add Dependency Injection into your project.

When the plugin is enabled, it will automatically create the necessary nodes in your current scene (preferably your Main). Simply add your node dependencies to the array in the [DependencyRegistrar] node and the [DependencyProvider] node will do the rest!

To allow dependency injection to happen in any script attached to a node in the scene tree, simply create either an _inject function or a _post_inject function, or both! But do keep in mind that these are only called after _ready.

This tool is useful in cases where:
1. You do not have direct access (via @export) to the nodes you need in a script and do not wish to create a global singleton via autoload.
2. You want a form of dependency inversion and wish to rely on abstractions to interact with other parts of your code.
3. The nodes you need have their own in-scene dependencies that they need to have direct access (via @export) to.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Simple Dependency Injection icon image
comfygrapes
Simple Dependency Injection

Easily add Dependency Injection into your project.When the plugin is enabled, it will automatically create the necessary nodes in your current scene (preferably your Main). Simply add your node dependencies to the array in the [DependencyRegistrar] node and the [DependencyProvider] node will do the rest!To allow dependency injection to happen in any script attached to a node in the scene tree, simply create either an _inject function or a _post_inject function, or both! But do keep in mind that these are only called after _ready.This tool is useful in cases where:1. You do not have direct access (via @export) to the nodes you need in a script and do not wish to create a global singleton via autoload.2. You want a form of dependency inversion and wish to rely on abstractions to interact with other parts of your code.3. The nodes you need have their own in-scene dependencies that they need to have direct access (via @export) to.

Supported Engine Version
4.4
Version String
1.0.2
License Version
MIT
Support Level
community
Modified Date
12 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers