Unity Penelope on the Android

Unity Penelope on the Android
Page content


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.

“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.

Penelope working on HTC Evo Android

Unity Penelope First Person Camera Mode on Android

Unity Penelope Third Person Camer Mode on Android

Unity Penelope Tap Mode on Android


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();

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.

This post is part of the series: Unity for the Android and iPhone

Tutorials, thoughts, and other tidbits on Unity for Android and iPhone mobile devices

  1. Tips for Porting the Penelope App from Unity