After publishing the early prototype of Super Snow Fight to Newgrounds, I thought making the main menu or making any menu at all would be the next step. Not to mention that people really need a menu so that they know where they are and what the hell is going on. So here is the result. I imagined two characters of the game standing in front of each other, staring at each other, knowing that they will meet on the battlefield to throw as much snow as possible in their opponents’ face.
I used the new UI System of Unity 4.6 called uGUI. In my opinion it’s a great improvement. You have the freedom to set anchors so that your GUI elements look good in every resolution. They resize themselves, change their position, even stretch if you want them to. In addition you can change the color in the editor, the font size, alignment of text, images/sprites and so on. In essence there’s no need any more for GuiStyles and that’s awesome. And everything is done without a single script. Although I added one script component to my text, which is an outline. And this stuff even is built into Unity. I love it.
For the character selection screen I used the new worldspace canvas. This way you can attach any GUI element to a gameobject in the scene, in my case the player characters. Also very neat is the way you can add the controller or keyboard/mouse buttons. First I want to thank Nicolae Berbece for making these awesome icons. You can simply import these images into Unity, use them as sprites and then just add the image as child to your label, text, button, whatever. Exactly how you do it with your three and two dimensional gameobjects or prefabs.
The scripting part is also pretty easy with uGUI. If you want to react on a button click, you add the script of your choice to the button and call a certain method on the desired event. Again, everything can be done in the Unity Editor. The script comes into place when you want to do some custom logic. I use scripts to jump between different menus and disable or enable specific buttons. For example, my MenuSetup script listens to the current gamestate returned by the so-called GameManager and enables the suitable menu (gameobject with canvas and gui elements). This way I can easily jump from the main menu, to the brawl selection mode, to the character selection and then to the ingame HUD. Oh, the HUD. The heads up display was a complete new chapter for me. But more on that in a later blog post.
In summary, making a game menu with the new Unity UI system uGUI is fun, you can create amazing art with the worldspace canvas (if you have the artistic eye, I don’t) and I think it’s suited for all needs of game development.
Here’s a little gallery of the creation progress of the main menu: