- Home /
Dependency injection related questions
Hello I have been looking into dependency injection, and while I don't fully understand it yet, it has rasied a few questions:
Is it bad to reference the same component or object in multiple scripts rather than having one reference and have all of the scripts refer to that one reference when they need it? If so, why is it bad? And am I correct in saying that this is the core reason of why DI is used?
Would it be plausable for me to create my own dependency injection system? I've seen Zenject but I prefer to write all of my own scripts if I can.
If the answer to question 2 is a yes, then what might be a good way to go about implementing my own dependency injection system?
Your answer
Follow this Question
Related Questions
Zenject factory from prefab not injecting into all components on prefab 0 Answers
config system for DI container like in Symfony 0 Answers
How do I inject dependencies into a Player prefab instantiated by the Network Manager? 1 Answer
Getting on drag functions into other classes 1 Answer
Zenject injecting upon instantiation 1 Answer