As many of you might know, I’ve been switched over to Unity for a year now, almost exclusively. In the past year I’ve had the opportunity to work on a variety of projects as a freelancer. This has given me a chance to check out a few different development tools such as Game Maker Studio, Cocos2d, and Xamarin. Out of all of the packages I’ve tried none of them come close to Unity. It’s clean, professional, stable, patched and updated to new tech frequently, easily extendable (the editor, Android/iOS plugins, etc), it easily ports to a bunch of different platforms, and there’s a HUGE support community surrounding it. I can clearly see why it is one of the top game development tools. If you can’t tell, I’m very happy with it.
Unity VS Toolbox is Born
Earlier this month I updated to Unity 5.2 which now comes with an installation of MS Visual Studio 2015 Community Edition (VS). I’ve been using VS 2013 for a while and built up some tools and templates in it, but they had become messy. So this gave me the opportunity to do some cleanup and build some other tools that I’ve been meaning to do. So I started a new public project on GitHub called Unity-VS-Toolbox. VS has the ability to create custom toolboxes. In this project I made a toolbox full of text snippets for each of the MonoBehaviour events. UnityVS Tools (the extension that connects Unity to VS) comes with something similar, an “Add MonoBehaviour Event” wizard. I always found this a bit clunky and it doesn’t have the MonoBehaviour events in order of execution. My toolbox can be pinned open in VS and has the MonoBehaviours in order of execution. So, not only is it a functional way to add the event to your code, but it works as a quick reference too!
After making the toolbox I decided to keep going and share some of my other VS settings with the community. I’ve added text snippets for most of the MonoBehaviours and a few handy templates. The text snippets allow you to simply start typing the name of a MonoBehaviour event and Intellisense will automatically create a method stub for you. Unity VS does something similar via a hotkey, but I find this much more fluid. The templates I put up are pretty bare-boned at the moment. They include an editor script, scriptable object, the standard MonoBehaviour, a MonoBehaviour singleton pattern and a template of a MonoBehaviour singleton class. I hope to add more patterns as I find use for them in my games. I’ve just begun exploring programming patterns to help expand my programming knowledge and further speed up my development process.
Unity Design Patterns is Born
I also created a GitHub project called Unity-Design-Patterns. The goal of this project is for me to explore the various programming design patterns detailed in Robert Nystrom’s Game Programming Patterns and make an example usage case in Unity. I feel this is a good way for me to learn more about design patterns and hopefully show other less-experienced developers a way they can be useful in Unity. So far I’ve only had a chance to explore the Command design pattern. It’s pretty useful and one of it’s main uses is that you can “record” and undo commands easily. It does have some caveats, though. You can read about these in the wiki page for the project. Next on the list is the Flyweight pattern. I’m having difficult time finding a good example to make for this type of pattern since Unity handles a lot of heavy lifting like this in the background. I could skip to a Singleton pattern, but I want to be able to describe a solid specific example of when to use them so that I can debunk some of the hatred that surrounds them. This project is a lot of fun and a good challenge for me as it gets me to think more about structures. I’m already seeing that I use some patterns without really knowing what they are and I can now take this opportunity to define them in a better structure.
Other Unity stuff
As always, thanks for reading!
PS – I’m joining the team at CleanSourceCode.com as a blog contributor so I’ll be writing more often and writing more about Unity there. Check us out on Facebook at facebook.com/cleansourcecode or on Twitter at @CleanSourceCode!