How To Make a 2.5D Game With Unity Tutorial: Part 2

This is a blog post by iOS Tutorial Team member Marin Todorov, a software developer with 12+ years of experience, an independant iOS developer and the creator of Touch Code Magazine. This is the second part of a two part tutorial series on how to make a simple 2.5D game for the iPhone with the […] By Marin Todorov.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Debugging with Unity

I'd like to shortly touch on few topics, because when you go on developing by yourselves you are going to run into trouble where you need to debug your game. So few simple things to keep in mind:

  • Don't forget there's a Pause button in the toolbar, so if you need to stop the execution of the game and check all object's properties - just hit Pause and then browse around your scene and lookup the values in the "Inspector" panel.
  • If you're not sure whether your method fires up, print a message in the console (much like in Xcode). Use: Debug.Log("message"); to print messages to the Console. You can bring up the Console window by choosing from the menu "Window/Console".
  • Develop this habit: When you're done coding in MonoDevelop and you switch back to Unity editor look at Unity's status bar (at the bottom of the application window) - if you wrote bad code, which won't validate - you'll get an error message in red in there, immediately after you bring Unity up.
  • If your objects don't move - triple check if your script is attached to your object!
  • When you run your game you can change values in the Inspector just to try out different values, etc. etc. When you stop the game: NB all values in the inspector are reset to the ones you had before running the game. Thus effectively if you forgot to stop the game and you made changes, they'll be lost, so be sure to stop the game after your finished testing and then continue developing.

Where To Go From Here?

Here is the complete sample project that we developed in the above tutorial series.

If you want to learn more about Unity you can look around their web-site; they have great Support section with examples, forum, etc: www.unity3D.com/support/. Also have a look at the Unity C# Reference.

If you want to practice more, you can extend Shark Bomber further by adding some of the
following features to the app:

  • Add explosion sounds, game over scene music/effects
  • Have 2 different explosions and randomly show them
  • Have different levels

This is a very very simple introduction to Unity - we barely touched on reading iPhone input, but I think you have now a solid understanding how thing in Unity work and that's more important to get you started!

If you think about it - you already know everything you need to know to also create 3D games! You've been translating objects around, rotating them to weird angles, you've been moving around the camera and basically nothing stops you from getting wild in the 3 dimensions. Just choose the right models, build some terrain (usually using a plane is a good idea) and you can pretty much do anything you want. So this was also your quick start into making 3D games with Unity!

If you have any questions, comments, or suggestions, please join in the forum discussion below!

Contributors

Over 300 content creators. Join our team.