1
\$\begingroup\$

Is it worthwhile for a solo dev to take up the widely recommended practice of using a dependency injection framework within the unity game engine? I have seen reason for concern regarding the clash of development methodologies that seems to have put some people off. If you would recommend against the practice, what would be a better substitute to avoid rigid bindings and singletons.

The focus of this question is primarily on the supposed clash with the unity way of things, which has apparently made a lot of people feel like they are spending more of their time fighting their tools instead of making games. I don't want to spend all my time worrying about nice code and have no game at the end of it, so advice and answers are appreciated.


So far my thinking is that it might be worthwhile for larger projects/ long term projects or projects with a team of more than a few people, but for small projects, time limited projects and indie/hobbyist projects its probably not a worthwhile investment of effort. Instead so far I'm thinking a minimum of tdd but then whatever you feel comfortable with, trying to maintain some of the most important principles in programming, such as yagni, kiss and srp. I watched a talk by johnathon blow where he essentially says to keep things simple and don't overthink them.

Am I mistaken in my assesment? Am I attributing more effort to working with di frameworks than is fair? Is it skewed by my inexperience? If you work with di and you find it actually speeds up your workflow while at the same time gaining the advantages di offers, please leave a comment or answer as you are someone I would love to hear from.

\$\endgroup\$
8
  • 2
    \$\begingroup\$ We can't tell you whether or not to use a particular library - that's a judgement call only you can make, based on your preferences, the needs of your project, and your research and experience with the tool. If you start implementing this library and encounter a specific problem, we can help you work around that, but it's difficult for us to give concrete solutions to hearsay "some comments say..." without the details of that issue spelled out in the question. Please consider editing the question to define one specific problem to solve. \$\endgroup\$
    – DMGregory
    Nov 24, 2017 at 1:22
  • 1
    \$\begingroup\$ This is a big topic and comes down to personal preference and the nature of the specific project. I just wanted to correct one thing you said - using zenject does not stop you from being able to use coroutines as explained here: github.com/modesttree/zenject#howtousecoroutines \$\endgroup\$ Nov 24, 2017 at 5:14
  • \$\begingroup\$ @DMGregory You're right about that, I only brought up zenject in particular because its the only one I know to have been made specifically for unity to work around issues that prevent other tools from being workable. \$\endgroup\$ Nov 24, 2017 at 11:58
  • \$\begingroup\$ @Steve Vermeulen That is good to hear, I will check the link. If coroutines were out then I would have lost interest completely. From what I've seen so far the zenject way makes code look rather ugly, but I will explore a little further. I like the sound of the promised outcomes \$\endgroup\$ Nov 24, 2017 at 11:58
  • \$\begingroup\$ In its updated form, this question looks like it's mainly soliciting opinions about preferred workflows. I don't think that's a good fit for the Q&A format on the main site, which expects a "correct" answer. You might want to consider asking in Game Development Chat instead, or on a discussion forum like those at GameDev.Net \$\endgroup\$
    – DMGregory
    Nov 25, 2017 at 20:40

0

Browse other questions tagged .