I’ve been using Unity for roughly 3 months now, and I have say it’s a great tool for 2D games, I would even go as far as to say it’s the best 2D game making tool I’ve used, and that’s coming from someone who has been using Flash for over a decade.
Why’s it so good? here’s my top 5 reasons (in no particular order).
5) Asset Store
I was aware of the Asset store before coming to Unity but until I started using Unity I didn’t realise just how useful the Asset store really is. There are always things in game development which you would rather not be doing, such as dealing with inputs or tile editors etc etc, I’m sure some devs like spending weeks creating them but I don’t, I would rather spend that time on coding the game. Unity’s Asset store has 1000s of ready made solutions for all kinds of things you would rather not be doing. You still need to do your research though to make sure you don’t buy something you don’t actually need, but other times they can be invaluable. Case in point the game I’m working on, I needed a tile editor, so I looked around and came across SpriteTile and I’m very glad I did, it’s saved me a huge amount of time, mostly because of the API because I know from experience that you need to be able to manipulate tiles in real time, and SpriteTile is perfect for that. On the other side of things is when you don’t need to buy an asset and can create your own. I needed to implement a mini map. There’s lots on the Asset store but most are for 3D games, and even the ones that include a 2D option I wasn’t sure if they would work with SpriteTile, so I decided to have a go at creating my own, and I did and it works great!
4) Tags and Layers
So many times in Flash I needed to group my movieclips according to different criteria. So I would have all my bad guy movieclips, good guys, player, missiles etc, the reason you need to do that is for all kinds of reasons, usually though for collision checking. So Player checks against bad guys, not good guys, missiles check against whatever and so on. Now in Flash you have to set that up in a number of different ways, you usually create separate classes, you can have flags to set according to who is what, it’s something that needs a lot of thought. In Unity it doesn’t need any thought, you simple create a layer and set your Prefab to that layer, then jump into the physics2D settings and turn on or off who does what collision checks against who in a handy little tick box grid thing. More than that if you want to grab an entire type of game item, say all the monsters you can just create a “Monster” tag, set your monster prefabs to that tag and then do a search in code to return all the gameObjects that have the monster tag! In Flash this meant keeping different types of game movieclips in different arrays, but you don’t need to do that at all in Unity. It’s such a great system, saves so much time.
3) Animation system
Flash has a great animation system. You can easy put graphics on the time line and move them around and it’s great for that. However if you are creating a game and you want to piece together a number of different animations, which need to switch in and out depending upon the situation then things can get a bit fiddly. I usually ended up with a kind of animation state variable which I was doing all kinds of checks against to make sure the correct animation was showing. In Unity this is a piece of cake, the whole animation window and animator window replace all that messing around in code by a simple visual means to link animations, and create variables that you can set in the code to switch to new animations. You can even trigger a function in your code on a certain keyframe. I’m still not up to speed on the more intricate elements of Unity’s animation but so far it’s been very useful.
2) Editor (seeing values in real time)
The editor is probably the main thing which puts people off when they first see Unity and it was no different to me it’s probably why it took me so long to get into Unity, you see all these values, all these different bits and it just looks more trouble than it’s worth. And it’s true to a certain degree, but it’s all there for a reason, and overall when it comes to 2D games the editor is really easy to use and does one very cool thing which is it allows you to see values changing in real time and you can change them in real time to see the effects. So far I’ve got by without having to use a debugger precisely because I’ve been able to see my vars in real time.
This is a big one. I used Box2D in Flash for many years, and it’s great (I think Unity uses it?) but when it came to setting it up and using it in code it was a pain in the ass, you were constantly having to deal with things from behind a veil so to speak, what Unity does so well is it allows you to see all your physics, it allows you to change things like gravity/mass etc in seconds, and you can test it just as quickly, and more than that everything is (can be) a physical object, so when I needed my particles to hit and bounce off my tiles I just quickly created a physics particle emitter and bang I had particles bouncing around the screen. It gives you a sense of freedom with how you can think about your game.
There are other great things from a 2D game making perspective but those are some of my faves so far!