Make A 2D Game in Unity3D Using Only Free Tools Part 1

Posted September 19th, 2011 in Tutorials, Unity3D, iDevBlogADay by Tim Miller

Make A 2D Game in Unity3D Using Only Free ToolsIn this iDevBlogADay post, I’m going to kick off a new tutorial series that’s aimed at making a 2D sprite-based game in Unity3D using only freely available tools, scripts and plugins. This isn’t the first 2D in Unity3D tutorial series I’ve done here – I previously did a 5 part series that used Sprite Manager 2 for the sprite display and animation duties. This time around, I want to show you how to make a game basically for free and I’m going to up the ante in this new series by adding in some other great plugins like iTween and A* Pathfinding.

Over the course of this series, we’re going to recreate one of my all time favorite C64 games: Lode Runner! I always wanted remake Lode Runner for my own amusement but also as a way to try out some things I haven’t figured out how to do yet – like creating an AI that can follow the player on ladders.

In this first installment, I’m going to introduce you to the tools we’ll be using and show you how to set them up in Unity. In the next part, we’ll dive in and start making the game. While we’ll be using the free versions of these tools, most of them also have paid options which unlock additional features.

Tools:

  • Unity3D: You probably already know that Unity3D is great tool for making 3D games, but it’s also pretty great at making 2D games with the addition of a few scripts and plugins. We’re going to be using the free version of Unity which will allow you to publish games to web as well as PC and Mac standalone but you can easily make the game work on iPhone or Android with a paid upgrade to those versions.
  • Orthello 2D Framework: There are several different sprite plugins available for Unity, the most popular being Sprite Manager 2 which I have used extensively and wrote about in my earlier 2D game tutorial series. I recently found myself looking for an alternative to SM2 and while doing research, @jeedee mentioned that he was quite satisfied with Orthello so I thought I’d try it out. In some ways it’s not as easy to use as some of the other plugins out there – you have to make your own sprite atlases for example – but for a free plugin it offers a ton of great features and will work perfectly for our 2D project.
  • iTween: iTween is my go-to animation system for every one of my projects here at Rocket 5. It’s ideal for animating everything from enemies to UI and it’s usually the first script I install when starting a new project.
  • A* Pathfinding Project: A* Pathfinding is probably the most widely used pathfinding system available for Unity. It’s fast, powerful, easy to use and since there’s a free version it’s perfect for our project.
  • TexturePacker: TexturePacker is a standalone app that makes it easy to create sprite sheets from your textures. You could use an image editing app like PhotoShop, Acorn or Gimp to make your atlases, but Orthello 2D recently added direct support for atlases generated by TexturePacker which should make things easier for us later on.

Starting A New Project:

  1. Install the latest version of Unity and then create a new project by going to File -> New Project, click the Set… button and browse to a location on your drive where you want to save your Unity projects, enter a name for the project and then click Save. Optionally you can select any packages that you want to import into the new project, I didn’t import any packages into my new project. Finally click the Create Project button.
  2. Create a new folder in your Project view and name it “Scenes” and then save the current scene by going to File -> Save Scene As, open the Scenes folder you created in the previous step, name it “level1” and then click Save.

Installing Orthello 2D:

  1. Open the Asset Store by going to Window -> Asset Store, search for “orthello2d“. The page for the plugin should display, click the Download button. Or download the latest version from the website, unzip the archive and double click on orthello.unitypackage.
  2. When the Import Package window appears, make sure that all the checkboxes are checked and then click Import. After a few seconds you should see an “Orthello” folder in your Project view.

Orthello 2D Initial Setup:

The Orthello website has tons of detailed information on setting up and working with the plugin so be sure to take a look. Following are my simplified steps to get you started.

In order for Orthello to work in the scene, you’ll need to setup a few things first. Note that you will need to repeat these steps in every new scene you create.

  1. In the Unity Project view, go to Orthello -> Objects and then drag the OT prefab into either the Scene view or the Hierarchy.

The OT prefab acts as a parent for Animations and Sprite Containers that we will be adding to the scene later on. Adding the OT object to your scene will also automatically make some changes to the Main Camara so that it will work properly for a 2D game – the main things are it changes the Projection to Orthographic and sets the Size to 332 (332 is kind of a weird size, but that’s the size that Orthello likes).

Installing iTween:

  1. Open the Asset Store again by going to Window -> Asset Store, search for “itween“. The page for the plugin should display, click the Download button.
  2. When the Import Package window appears, make sure that all the checkboxes are checked and then click Import. After a few seconds you should see an “iTween” folder in your Project view. If you want you can delete the “ReadMe!” and “Sample” folders if you want but they won’t hurt anything and it’s a good idea to look at the sample scene if you’ve never used iTween before.

Installing A* Pathfinding:

As I write this, the free version of A* Pathfinding is not available for download from the Unity Asset Store (the paid version is though).

  1. Go to the website, click on Download Latest Version and then click on A* Pathfinding Project in the Download area which should download a file named PathfindingProject_Free.unitypackage onto your computer.
  2. Double click on PathfindingProject_Free.unitypackage which will open the Importing Package window in Unity. Make sure all of the checkboxes are checked and then click Import. You should now see a folder named “AstarPathfindingProject” in your Project view.

A* Pathfinding Initial Setup:

Be sure to read the “getting started” page in the A* Pathfinding Documentation for a full explanation of how to setup A*. Here are my simplified steps to get you going.

  1. Create a new empty game object by going to GameObject -> Create Empty.
  2. Make sure that the x,y,z position of the game object is at zero and then rename the object to “A*“.
  3. Add the Astar Path script to the game object by going to Component -> Pathfinding and then click on Pathfinder.
  4. With the A* object selected in the Hierarchy, you should see Astar Path script’s options in the Inspector. At the top of the script you should see a message that says “Do you want to enable Javascript support?”. Since all of the scripts used in this tutorial are going to be written in C#, you can go ahead and click “No” (you can change this later in the settings if you want).

Conclusion:

If you followed all of the steps above, then your project should look something like this (click to see larger image).

The cool thing about the project is that you can use this as a starting point for creating all kinds of 2D games so keep this around as a base for starting new 2D projects (although be sure to check for the latest versions of the scripts).

Further Reading

Make A 2D Game with Unity3D Using Only Free Tools Part 2
Make A 2D Game With Unity3D Using Only Free Tools Part 3

Share
  • Da Voodoochief

    This looks really interesting and i will have to follow your series, as getting into Unity is something on my list and having a well thuoght out approach like yours will be invaluable. Keep up the excellent work.

    Da Voodoochief

  • http://www.rocket5studios.com/ Tim Miller

    Glad to hear you’re finding it useful.

  • http://twitter.com/robotvevrything Seymour Bermudez

    Definitely going to follow this.  Always interested to learn what Unity is all about. One question: what is that Editor folder in your project?  My project didn’t end up having that one.  Looking forward to the next post…

  • http://www.rocket5studios.com/ Tim Miller

    Good catch.  I was originally going to include this script http://www.unifycommunity.com/wiki/index.php?title=IPhoneTextureImportSettings in the project but since Orthello doesn’t need the source textures to be in the project, I decided to leave it out.  I didn’t notice the Editor folder was still in there until after I posted the screenshot.  :)

  • http://twitter.com/robotvevrything Seymour Bermudez

    Ah cool. Do you have any recommended tutorials out there for getting used to Unity in general (prior to going through the one you are working on)?  My skills are primarily in C#/XNA and have never touched unity.  Thanks!

  • Robert Stehwien

    @twitter-242149350:disqus I’ve really been liking these tutorials http://www.walkerboystudio.com/html/unity_training___free__.html

    @rocket05:disqus I’m really looking forward to this tutorial.  I loved Lode Runner!

  • http://www.rocket5studios.com/ Tim Miller

    The tutorials that Robert mentioned are awesome and 3D Buzz also has a lot of good tutorials: http://www.3dbuzz.com/vbforum/sv_home.php

  • http://www.rocket5studios.com/ Tim Miller

    I hadn’t see those Walker Boys tutorials before, nice find!

  • Jaysen Edgin

    Just thought you might be interested to know the current Orthello 2d release has a tween class included in it.

  • http://www.rocket5studios.com/ Tim Miller

    Yep, I saw that.  Haven’t tried it yet but I’m super happy with iTween and I’m already familiar with using it so I might still stick with iTween for the tutorial.  It’s nice to have options tho.

  • http://twitter.com/Fawdda Mohamed Almonajed

    Tim you’re GREAT!!

  • Pingback: Tutorial: Mit Unity3D ein 2D Spiel entwickeln – Part 1 - Der Softwareentwickler Blog

  • Pingback: Make A 2D Game with Unity3D Using Only Free Tools Part 2 | Rocket 5 Studios

  • Pingback: Tutorial: 2D Games in Unity3D mit kostenlosen Tools – Teil 2 - Unity News

  • Mark

    Great Tutorial, really helped :) The prices are crazy for unity!

  • http://www.rocket5studios.com/ Tim Miller

    Thanks, glad to hear it helped!

  • Yanuar Valentino

    it looks like the link for a* pathfinding is dead, 
    would you mind to give another link or upload it?

  • Yanuar Valentino

    sorry looks like the link is already up again