Pin Me

Tips for Porting the Penelope App from Unity

written by: ina•edited by: Simon Hill•updated: 12/23/2010

The iPhone Penelope tutorial and app from Unity works directly on your Android device - but here are some tips and common pitfalls you may run into while porting this app, originally designed for the iPhone, to Unity Android (beta).

  • slide 1 of 5

    Overview

    Unity3D is a popular game engine used for games across a variety of platforms -- most notably by mobile developers, Unity publishes to both iPhone and Android devices. While the Android port is newer and currently lacks sufficient documentation and tutorials, many of the iPhone tutorials work straight out of the box. One classic tutorial is Penelope, a complete game for the iPhone that demonstrates multi-touch tap-support, and several camera view control algorithms.

    As of this writing, there are no Unity tutorials for the Android. Hopefully this piece might help mobile developers and enthusiasts get started on Android development using the Unity engine.

  • slide 2 of 5

    "Raw" Test Run

    From my sample run - it looks like the Unity Penelope Tutorial for the iPhone works seamlessly on the Android: Open up the Completed Project. Choose publish to Android. And, voila! I was able to try out all three game modes - Tap, FirstPerson Cam, and Third Person Cam. Multitouch worked splendidly -- in tap mode, I was able to press down two fingers, rotate-drag my other finger to rotate the view; in the camera mode's, I was able to control both joysticks at once.

    On my Android devices with smaller screens (Motorola Defy), I was not able to complete the game goal of collecting in time, but I was able to complete the goal relatively easily on my HTC Evo (with Sprint bloatware) and Galaxy Tab.

  • slide 3 of 5

    Penelope working on HTC Evo Android

    Penelope working on HTC Evo AndroidUnity Penelope First Person Camera Mode on AndroidUnity Penelope Third Person Camer Mode on AndroidUnity Penelope Tap Mode on Android
  • slide 4 of 5

    Caveats

    Unity Android, as of December 2010, is still in beta. Many of the materials on the iPhone might or might not work for your target Android device, depending on your device limitations. Keep in mind that, unlike the iPhone, Android is composed of a wide range of devices with different hardware created by many manufacturers. Your app would be exposed to any of these devices.

    Unity Remote is not yet available for Android. If you need to track variables, one quick and dirty way to do that is to put in a GuiText:

    1. Game Component > Rendering > GuiText.
    2. Name it something, say “DebugTexter".
    3. Define a global variable, assign it to this GuiText in Start():private var log:GUIText;function Start(){log = GameObject.Find(“DebugTexter").GetComponent(GUIText);}
    4. Then put this anywhere you want the GUiText to show text (likely in your Update())(Say, you want to track the tapCount variable in your guiText)log.text=tapCount.ToString();

  • slide 5 of 5

    Common Pitfalls

    Out of Space: This is especially problematic if your phone comes with a lot of bloatware from your carrier or other “value added reseller." One way to deal with this is to set the app to store directly on the SD card.

    Can’t Add Script: “Can't add script behaviour Joystick.js. The scripts file name does not match the name of the class defined in the script!" - Rename your script in the Project pane to *not* contain the explicit .js extension.

    Bundle Identifier has not been set up correctly. “Please set the Bundle Identifier in the Player Settings. The value must follow the convention: ‘com.YourCompanyName.YourProductName’ and can contain alphanumeric characters and underscore. Each segment must not start with a numeric character or underscore.

    In Edit > Project Settings > Player, open up the “Other Settings" rollout in the Inspector pane, and enter in something that’s alphanumeric, following the convention above.

*Please note - the author received 'Unity Android Trial' from a company other than Bright Hub in order to develop the content contained within this article or review.