Hi Guys,
I’ve been studying up for a fair while on design patterns to use with Unity the past week. I’m still fairly confused with all the options, with no official go to from any Unity Tutorial. My research thus far has led me to these sites:
IoC & Dependency Injection
Blog Argument for IoC Containers for Unity: Lightweight IoC Container for Unity - part 1 - Seba's Lab
Indie Made IoC Container: Simple IoC Container for Unity3d - CodeProject
Asset Store - StrangeIoC: Unity Asset Store - The Best Assets for Game Making
Asset Store - Adic - Dependency Injection Container: Unity Asset Store - The Best Assets for Game Making
Asset Store Zenject Dependency Injection: Unity Asset Store - The Best Assets for Game Making
Singleton
Singleton Pattern with Delegate Array State Machine:
Argument For & Against Singleton Use: Using static function in Singleton, bad design? - Unity Engine - Unity Discussions
Singleton Pattern: http://wiki.unity3d.com/index.php/Singleton
Toolbox (Upgrade of Singleton): http://wiki.unity3d.com/index.php/Toolbox
State Machine
State Machine Tutorial:
Now I’m beginning a project that might span over a year or two, and am deeply considering different approaches for what design pattern to use. After all this, alongside KISS and YAGNI, I’m at a slight loss for what pattern to use still.
Overall from what I’m reading, they’re saying that IoC containers are generally much better, but less approachable than the Singleton Pattern. That you can’t Unit Test the Singleton Pattern, and that you can eventually get a jumbled mess of dependency. However using the IoC container is a fair amount of work (?? I’ve never used them), and you need to remember KISS and YAGNI, so an IoC Container may be unneccessary (?? Again I don’t know).
The problem is I’ve never used an IoC Container and I’m a bit green with them. I don’t know how easy they are, and whether they’re worth investing in something I’m not used to. I’ve made a lot of games using the Singleton pattern, but they tend to be 3-8 month projects. I’m not sure whether to start simple and expand, or plan the entire thing with a large(ish) framework.
Can anyone throw me any solid input?
Thanks!