Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
October 20, 2014
arrowPress Releases
October 20, 2014
PR Newswire
View All
View All     Submit Event





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
Using Unity to Make 2D Games - The Interface
by Tony Yotes on 09/01/13 04:42:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.

 

 

2D Toolkit

   The first thing to get for Unity for easy 2D game making would be the 2D Toolkit from Unikron Software. There are plenty of other ones out there but I picked this one because it was the most popular and seems to have the most support, tutorials, and documentation. 

   The toolkit is available in the Unity asset store, it looks a lot like the iTunes store but it's full of thing to use in Unity like assets, templates, tools, and interface upgrades. I bought the 2D Toolkit for $60 (USD). It's definitely worth every penny because it has saved me countless hours of frustration and I can now use it for my future projects too. I also could afford it because I got it the same day Unity made it's Android and iOS development packs free. They used to cost $800 total and I had money saved up to buy them, luckily I felt like checking Gamasutra before getting started with my first Unity project and I saw that the kits were just made free for developers! It seems like Unity is constantly doing things to make my job easier.

Unity Layout

 

    The Unity interface is my favorite to use because it let's organize it in any way you'd like and it also has at least three different ways to do the same task, allowing users to pick their favorite. The main things to note here are the ProjectHierarchyInspectorConsole, Scene, and Game windows. It is possible to cluster and arrange them in any way but I like to have them separated and on either side of the Game and Scene windows with the exception of the Console window (because I don't use it as much) which I paired with the Inspector because one is useful for game setup and the other is useful for debugging.

 

Make the menu easy for you to use.
Just drag the windows to arrange them.
   I even made a couple preset menus for future use, one for landscape games, and one for portrait. I also always make my Scene window bigger than the Game one because that's where I do most of the editing. I like to keep the game window about the size of the actual screen I would play it on.

  Project Window

           

 

   In the Project window you can see all the main folders for your project. You can find all your sprites, sounds, scripts, fonts, and scenes here. You can make and arrange folders to stay organized in a way that makes sense to you. The folders are on the left and the highlighted one's contents are on the left. The contents can be shown as images or icons with text and you can use a slider to change their size.

  Hierarchy Window
 

 

  In the Hierarchy window you can see all the things active in the game scene. All instantiated objects are listed here, including any clones. You can also see all the child objects by clicking on the arrow next to the parent object and finding them in the list that comes out. I often use it to arrange menu items by putting all the buttons as children of a button near the center of the screen so they are always aligned the way I want them. 

 

   Selecting something in the Hierarchy window makes it's information appear in the Inspector window and also highlights the object in the Scene window. 
  Inspector Window
 

                           

 

   In the Inspector window you can change the properties of objects. You can add scripts, components, and sprites to objects. Scripts make the objects act, components can enable things like physics and sound, and sprites can be picked out of sprite collections.

 

  

 

   It's a nice little info tab for everything and it lets you change object properties easily. You can even move the components around and move the stuff you like to use most to the top.

 

                             

   You can see a preview of a script's code here when you select it in the Project window. It's nice to see if you need a quick reminder of what code it is. It's more useful if there is code documentation commented at the top telling what the script does. In regular code, things are arranged in classes with methods but in Unity, objects are basically a given and you just need scripts to tell them what to do.
  Console Window
 


  In the Console window you can see error messages and text you call with the console menu. Think of it as the same console window in any programming application, where all the System.out.println or 
cout << stuff would go. 
  Scene & Game Window

   In the Scene window you can drag and drop objects, move them around the scene and in the Game window you can see how they look in game. There are play, pause, and forward buttons that affect the game. When testing the game, pausing becomes useful. You push play to start playtesting and you can pause to alter things in the game scene. Just remember: all changes made while the play button is lit will not be saved! Also, I've never used the forward button. Not even sure what it does really.
   

                             


  The Scene window also will show things that may be hidden in the actual game. The game screen has a lot of preset display sizes and the Game window has lots of playtime stats it can display with a switch at the top.
  Build Window
 


  When you're ready to build and test on a device this menu pops up. You can drop and drop all the scenes you want in the game then pick a platform to make the game for. Then just follow a few steps to plug in a device and Build & Run.

                             

 

   You can also select things like icons and platform specific settings. 
  Scripts & Sprites
 

 

  Unity has it's own script editor, MonoDevelop which makes it easy to change code for the game and test it quickly. You can code in JavaScript, C#, or Boo. You can keep them all open, or just use the scripts you edit most. You can even open MonoDevelop without opening Unity.


  When importing sprites you just drag & drop from your documents and select it in the Project window. When you do you can alter it's settings for transparency and resolution. When you push the open button you can either edit it or look at a preview depending on your computer's default reaction to double clicking an image file.

 

  After that making a sprite objects with 2D toolkit is a matter of going to the Hierarchy window and pushing the create button.

 

  2D toolkit has sprite images stored in Sprite Collections you make to use for the Objects in the game. You drag & drop the sprite files from Project to the Sprite Collection and then attach collision boxes and anchor points. Sprite images can only be used if they are in sprite collections. 

Polygon colliders let you make weird shapes


  Once you get familiar with the environment and watch a few tutorials, using Unity will be as easy and natural as navigating a web browser. Hopefully this little walkthrough gave some insight into how Unity works and feels. Now with this new knowledge pen it up and give it a try!


Related Jobs

Monochrome LLC
Monochrome LLC — Aptos, California, United States
[10.19.14]

Senior Programmer
Gearbox Software
Gearbox Software — Plano, Texas, United States
[10.17.14]

Server Programmer
Digital Extremes
Digital Extremes — London, Ontario, Canada
[10.17.14]

Generalist Programmers
Petroglyph Games
Petroglyph Games — Las Vegas, Nevada, United States
[10.17.14]

Network / Web Programmer






Comments



none
 
Comment: