98

Creating Android games with Unity

Posted by Dr. Burton on December 17, 2010 in Android, Game Development, iPad, iPhone, Mobile, Unity3D |

NOTE: This tutorial was developed using Unity3D V.3. I have not tested it with the latest version of Unity. I hope to create a new version of this tutorial in the near future taking advantage of the latest Unity 3D features.

I’ve had a lot of requests for tutorials on game creation for the Android based phones and tablets.  This will be my first (but not last!) tutorial.

I have two, 20 minute videos that take you through the process of creating a simple flight game.
If you are new to Unity and/or game development, check out my eBooks on the full Unity Pipeline!  The books are updated as new versions of Unity 3D become available. Updates are free!

You will need the Unity engine to follow along (http://unity3d.com).  While the Android version of the software is expensive, you can do everything with the basic free version except publish to the actual device.

In part 1, I cover general setup and needed software to be able to publish to android devices.  I also cover the first steps in setting up a game environment including skybox, and player.

[tubepress video=1Kf2D0UdgY0]

In part 2, I cover the creation of the asteroids, bullets, prefabs, and use pre-existing scripts to add player control.  I also cover the publish to the android device.

[tubepress video=2lOCnNtI6ZQ]

I would note that while this process was specific to publishing to an Android phone, everything would work exactly the same (minus the publishing) for an iPhone or iPad.

Here are some of the assets (Scripts, Rock and background)

Note: The scripts used in the demonstration are all available from the StarTrooper example on the Unity site: http://unity3d.com/support/resources/tutorials/iphone-multiplayer-tutorial

Tags: , , , , ,

98 Comments

  • BoKKeR says:

    Hi I started with your tutorial (http://www.burtonsmediagroup.com/blog/2010/12/creating-android-games-with-unity/) but there is a litle problem when I add the control script what is made for iphone or ipad it says iPhoneSettings.screenOrientation is bad so use ScreenOrientation blabla . so there was some of iOS inputs what I replaced with android inputs but the script is not working the model for I assisted it is not moving (http://nightslax.org/script.unitypackage) And there is other thing what i want to ask. When there is skybox for windows standalone the skybox is from 6 pictures but for the mobile is just one 2D picture to use. Is there any way to use the 6 picture skybox for mobile devices. Sorry for my bad english, please help.
    btw nice tutorial 🙂

  • John Smith says:

    Sir, the assets zip file does not contain any scripts. I need to learn how to utilize the accelerometer. Thanks

  • papmodern says:

    Hi
    Tnx for amazing Tutorial
    I have a problem
    when I want to run and test my game in AVD or my phone the apk file doesn’t made.I’m going to file>Build Settings and after set the player settings going to click on Build & Run .after that unity start Building.after a wile that ask me where the Android SDK is and I Select that Folder target then Nothing,Unity without no Errors Stoped the Prossesing and the apk file didn’t Made 🙁
    Plz help!
    And sry for my English 🙂

  • PJ says:

    Hey great tutorial but if I wanted to do something XPERIA PLAY optimized what do I do?

  • ianseer says:

    Thanks for a great Tutorial there… This is what i looking for… really.. thanks

  • Dilliraj says:

    Hi
    This is really a very useful tutorial for beginners, keep up your great work.
    Thnak u for a great share.

  • Lan says:

    Quality tutorial right here. You are a clear and calm speaker and really explained why we were changing those values, instead of just changing and not knowing what it really did.

    Thank you, and don’t hesitate again to share your knowledge.

  • hi sir well ur tutorials were very helpful am strugling to get the button work in android but am not ble to solve the problem can u help me out please sir. thanks in advance

  • Ryan says:

    Thank you for the tutorial! However, I am having a problem with movement in the game… It seems that once i went through the tutorial, none of the asteroids are moving… Any help would be greatly appreciated!

  • Anonymous says:

    hi, unity for Android and iOS are free until April 8th

  • haawa says:

    Hi, i was wondering how i can connect my game made in unity3d with activities that i made in eclipse with java code? Or is there any way to create activities like “main menu”, “options” etc in unity3d? I will really apriciate any help, specially links with some tutorials.

    Great job done btw.

  • I’m not sure where you are getting your information, but great topic. I needs to spend some time learning more or understanding more. Thanks for magnificent information I was looking for this info for my mission.

  • Janson says:

    Hello Doc. Thanks for the great tutorial. How about the ‘Marmalade’ SDK? did you ever try that? I’m just trying to find out the best to learn.

  • Mark says:

    Hi, and thanks for all the effort. I thought I had done everything according to your directions, but…when checking the adb devices in the command prompt, nothing is listed. When checking the device manager no phone is listed…so I can’t update the drivers…the android sdk is installed as is the java and eclipse. When running the “helloWorld” tutorial all appears fine but the text does not show up in the emulater. What am I missing….?

    thanks again

  • Nicky Wild says:

    Hullo, doc.
    I read your comment of not having permission to release your game to any market. But I was wondering; Could you give an example of this?
    I mean, if I make a game in a space, BASED off your tutorial, with custom materials and meshes and all. Would that still apply?
    And how about the coding? Am I allowed to use them or tweak them and then use them for a game I publish?
    Thanks in advance.

  • Dr. Burton says:

    Creating something based off of one of my tutorials is fine. I just don’t want to see someone publishing what I created as their own work. Everything in the tutorial is available for your use.. just make it better, add your own code, graphics, effects, etc and make it YOUR game!

  • Daz Gozzett says:

    Dr.B , nice work on the tutorial, helps out alot.

    Any chance of a tutorial for 2dPlatormers (Like doodlejump or HyperSpace). Also, would it be possible to do this without Rigidbody?

  • Dr. Burton says:

    Daz, For 2D I prefer to use Corona SDK. It is lighter weight than Unity, easier to develop in, and looks great on mobile devices. You can see both games in the book I recently wrote “Mobile App Development with Corona: Getting Started” which is available on my website, Amazon, Kobo, and soon, the iBookstore.

  • Shirley says:

    Hi, my name is Shirley and I’m new in Unity. I want to ask.
    I’ve already made a simple project using Unity for Android, but now I want to know how to adjust the screen because Android have many screen.
    Thank you.

  • fcs says:

    Hi Doc,

    I’ve just stumbled upon this tutorial. Before i get myself engrossed in the videos i was hoping you can please answer a few questions for me.

    Would you recommend building android apps before jumping into game development?
    What skill level do you recommend someone must have before pursuing game development 2D/3D?

    I understand that your opinion will be subjective but i’m keen to hear it nevetheless.

    My background: Intermediate knowledge of java. I have created a few basic java gui apps and i do use eclipse.

    Thank you,
    fcs

  • Dr. Burton says:

    @FCS,
    Yes, experience creating non-game apps before tackling a game app is recommended. It gives you a change to learn the fundamentals of the development environment before tackling a more complex project like a game. Once you feel you are ready to do a game, I highly recommend doing a few 2D games before doing a 3D game. For game development I recommend Corona SDK by AnscaMobile.com for 2D and Unity3D.com for 3D games.

  • Antonio says:

    First of all, this tutorial is amazing.

    Now, i finished the tutorial but mi ship is not moving, there’s a problem with the Player Control script, it says that a tag is missing, I believe they changed the scripts in the star trooper tutorial. Do you have any idea about how to fix the error?

  • ZacH says:

    I seem to be having the same problem.

  • Zach says:

    This is the error that is occurring:

    UnityException: Tag: SpaceCraft is not defined!
    UnityEngine.GameObject.FindWithTag (System.String tag) (at C:/BuildAgent/work/b0bcff80449a48aa/Runtime/ExportGenerated/Editor/UnityEngineGameObject.cs:231)
    PlayerControls.FixedUpdate () (at Assets/Scripts/PlayerControls.js:34)

  • Avraham says:

    I also have this same problem. I followed all the steps [that I’m aware of] and I when I go to build and run everything is ok in loading all up to the end of the load where it tells me that the APK file could not be installed to check the console. I’m not sure what the console is either cause it doesn’t explain what it is, I’m guessing it’s the build settings area. Also, when I check the error code at the bottom, it says error is in the file 1 section. How do I check that I don’t know.

  • Avraham says:

    Hi DrBurton, I followed all the steps [that I’m aware of] and I when I go to build and run everything is ok in loading all up to the end of the load where it tells me that the APK file could not be installed to check the console. I’m not sure what the console is either cause it doesn’t explain what it is, I’m guessing it’s the build settings area. Also, when I check the error code at the bottom, it says error is in the file 1 section. How do I check that I don’t know.

  • Dr. Burton says:

    I’m afraid it will be a few weeks before I can get back to you on your questions.. it’s finals time here….

  • eri albar says:

    Thanx

    this tutorial help me to learn
    this only video on youtube can teach me

  • Avraham says:

    I get all kinds of errors when using the iphone js that is provided by Unity’s startroopers game. After importing them an attatching them to the the prefabs I ran the game and picked up plenty of errors. Isn’t this code only for iphones instead of android platform? How did you get it to function correctly?

  • Avraham says:

    Ok Doc Thanks atleast for giving me heads up on it though. When you do come around and are able to answer us again, I just wanted to update you about my dilemma that I had, it’s all taken care of however I have been unsuccessful in being able to publish to my android device only the launch icon displays on my phone and the splashcreen but non of my work ever loads. I have followed everything to the “T” SDK, JDK, etc … all is installed properly I even have created the new keystore file [which gave me problems at first btw] but I was able to conquer the problem and whala ZIP,ZILCH, ZERO NADA lol . Well, hope you’ll be able to help me soon so I can restore some very needed encouragement on creating a game application. I will put my work on hold till you’re able to help me, this has exhausted me quite a bit.

    Great tutorials by the way. I wish I can make you proud some day and create a spectacular game haha.

  • dmerene says:

    the tutorial on space shooter was very useful for me! thanks! 🙂

  • Tiago Peixoto says:

    First of All this tutorial i want to say that this great tutorial made me understand a lot more than all other tutorials from unity itself.
    Now I wan to add that i had error that some people are getting related to the movement issue and for those who couldn’t get past this I finally got the answer:

    1) Click on your spacecraft and on the Inspector menu, look for the
    dropdown menu called “Tag” and select “Player”
    2) Double click on the “PlayerControls” script in the project menu
    3) You will open another program to edit the script and all you
    have to do is replace all the “SpaceCraft” with “Player”

  • […] More details about these tutorials can be found on the Burton’s Media Group Blog Share this:TwitterFacebookLike this:LikeBe the first to like this post. […]

  • Paulo says:

    Hi! About screen diferents cellphones and tablets (android system)…how automatic screen resoltion configure?

  • winresh says:

    sir can i ask you why can’t i move my joystick but i use the standard mobile assets in unity is there anything wrong to the joystick.js of penelope by the way im trying to develop and fps android game….do you have a tutorial for it?

    Im hoping to your response thanks in advance sir….:)

  • Billy says:

    Hi,

    I have been following your tutorials, they are really great.

    I am stuck at the scripts part, when I apply these scripts i get an error messages because the scripts are based on iphone, can u please provide me with android scripts ?

  • stue says:

    Thank you for the fix for the tag it works perfect now everything run’s great

  • Dan says:

    Billy,

    You should not be getting errors. You should be getting warnings and be able to build.

    Dan

  • Shona_boy says:

    Hi. Amazing tutorial. Just wanted to know if they is a way to incorparate i.o.i.o accessories to games in unity that will work on the ported Android app.

    Thanks.

  • Kelsey says:

    Billy,
    I got some warnings about the iPhone variables as well. You should be able to ignore them, or update to what the compiler suggests. One thing I noticed is that the version of Star Trooper I got has a craft object that had to be dragged onto the Player Control script. Also, the same script was actually looking for the space ship to have a “SpaceCraft” tag, so I added that. Hope that helps!

  • juan cruz says:

    se puede transformar un juego de iphone a android como dice en algunas paguinas web

  • Arsalan Shah says:

    well i downloaded your resources but one of them is 3ds max made what do i do cant i get it without download 3ds max

  • kenny ol says:

    it says fix all compile error in the script when im dragging player control script what should i do??

  • Francis says:

    sir can you teach me how to create a interactive game for andriod?

    i dont have a clue on how to do it..

    thank you sir

  • Dr. Burton says:

    We will soon have several books available on creating interactive games with Unity v4.x. Expect to see an announcement within the next few weeks!

  • Bill says:

    Hello, I am trying to follow your tutorial but the controls that i have found are in C# Can I do this the same as your tutorial?

  • Bill says:

    where are the rest of the videos to finish your tutorial?

  • […] Part 1 of 2. Dr. Burton created this video as a part of a grant competition to show how easily a simple game can be created for the android devices using Unity. The full tutorial can be seen at http://www.burtonsmediagroup.com/blog/2010/12/creating-android-games-with-unity/ […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Copyright © 2010-2019 Burtons Media Group All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.