Hi, so yeah, we made a game… 🙂 for a penguin named Maru:

(And his clones…)

He’s actually a flash drive:

Yes, his head is um… removable? But it’s all for a good cause!

So anyway, app description:

Maru Penguin is an adventurous game which combines the elements of action and intelligence. By pulling backward and forward the users can control the extent of jumping. Lots of hidden props can be found in different chapters to help the Maru Penguin to achieve his mission. The cartoon style, the well-known capitals as the main scene of the game and the cute background music creates a delightful atmosphere while playing.

Maru Penguin是一款動作結合益智的冒險遊戲,遊戲操作相當容易,玩家利用指頭觸控畫面中的Maru Penguin,往後拉動控制Maru Penguin的跳躍弧度,關卡中埋藏著各種道具,使Maru Penguin更能輕易地到達終點。遊戲畫面為可愛卡通風格,同時結合亞洲著名城市做為遊戲關卡背景,搭配活潑生動的背景音樂,使玩家能
Maru Penguin一同在全球各大城市展開冒險。

Use of well-known cities as the stage of the game.
Abundant choices of props
Adorable characters
3D environments
Simple instruction is easy for users to get familiar with.
Suitable for user of all ages.

– 以全球著名城市作為關卡主題。
– 豐富的道具供玩家使用。
– 企鵝肢體活潑逗趣。
– 遊戲以3D展現,畫面精緻度高。
– 操作模式簡易明瞭,操作門檻低。
– 適合0-99歲的各種玩家。

Story background
The global warming has put the Maru Penguin at steak and he has faced the risk of food shortage. With moving his finger the player can aid the penguin to conquer all the obstacles during journey.

由於全球氣候暖化,企鵝Maru面臨嚴重的糧食危機,他行遍五大洲只為了找到美味的小魚兒。玩家利用一指神功左右滑動,協助不會飛的Maru 跳躍障礙,成功填飽肚皮!!

And screenies…

And… *cue link*…

Link: http://itunes.apple.com/tw/app/maru-penguin/id521096937?mt=8

Download, please and thank you? 🙂

*sorry Twitter followers for repeat posts*

Mini Tutorial: How to post score of your Unity iOS game to Facebook?

-without shelling out $65 😉

Well, if you have $65 to spare, just check out Prime31’s Social Networking plugin (you can even get Twitter!).

Link: http://www.prime31.com/unity/

If you don’t, like 1-broke-girl/me, read on…

There are two parts to this, Unity side and Xcode side. We must find a way for Unity and Xcode to be friends and talk to one another, you know call each others’ functions, access each others’ variables etc.

First let’s take advantage of NSUserDefaults and PlayerPrefs to save some variables (you may encrypt the score variable if you are afraid of cheaters).

PlayerPrefs in Unity…

PlayerPrefs.SetString(“score”, score.ToString());

… can be read in Xcode using…

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *score = [defaults objectForKey:@”score”];

There, we know how to pass variables, what about functions…?

In order to do that, I read this tut, which is in Simplified Chinese!  (http://xys289187120.blog.51cto.com/3361352/705415). The gist of that tutorial is that you create this other class (let’s just call it Facebook.cs):

using UnityEngine;  
using System.Runtime.InteropServices;  

public class Facebook : MonoBehaviour {

     private static extern void _PressButton0 ();  

     public static void ActivateButton0 ()  
     {  if (Application.platform != RuntimePlatform.OSXEditor)   
        {   _PressButton0 ();  

The _PressButton0() will actually call some code in Xcode (we’ll get to that).

Someone else in Unity has to call ActivateButton0, a GUI button, perhaps?

if(GUI.Button(new Rect(0, 0, 130, 235), “Facebook”))
{       Facebook.ActivateButton0();

So when the player clicks on the GUI button, ActivateButton0() will be called which will in turn call _PressButton0().

But where’s _PressButton0()?

We create a ViewController class in Xcode (let’s just call it MyView.m):

#import “MyView.h”
#import “AppController.h”

@implementation MyView

void _PressButton0()  
{   AppController *appController = (AppController*)[[UIApplication sharedApplication] delegate];

    [appController feedDialogButtonClicked];


So there’s _PressButton0()!

Now let’s do the Facebook related things. Go to Facebook’s Developer site and follow the tutorial: https://developers.facebook.com/docs/mobile/ios/build/

Instead of putting some stuff in ApplicationDidFinishLaunchingWithIOptions… I placed everything in a function I called feedDialogButtonClicked.

– (void) feedDialogButtonClicked {
    facebook = [[Facebook alloc] initWithAppId:@”221872691249521” andDelegate:self];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@”FBAccessTokenKey”]
        && [defaults objectForKey:@”FBExpirationDateKey”]) {
        facebook.accessToken = [defaults objectForKey:@”FBAccessTokenKey”];
        facebook.expirationDate = [defaults objectForKey:@”FBExpirationDateKey”];
    if (!)
    {   ;
    [[NSUserDefaults standardUserDefaults] synchronize];
    NSString *level = [defaults objectForKey:@”level”];
    NSString *score = [defaults objectForKey:@”score”];
    NSMutableDictionary *params =
    [NSMutableDictionary dictionaryWithObjectsAndKeys:
     [NSString stringWithFormat: @”I just scored %@ in the %@ Level of Maru Penguin!”, score, level], @”name”,
     @”“, @”caption”,
     @”Get Maru Penguin for free in the iTunes Store”, @”description”,
     @”http://itunes.apple.com/tw/app/maru-penguin/id521096937?mt=8”, @”link”,
     @”http://a2.mzstatic.com/us/r1000/082/Purple/v4/3a/42/b5/3a42b5dc-5452-9dde-cdc8-24e24fb82363/486SkNsbbo2zaF3glfCuo0-temp-upload.iomrjeon.320×480-75.jpg”, @”picture”,

I had a little problem with fbDidLogin (the one mentioned in the tutorial), good thing this other tutorial solved it for me: http://ebrentnelson.blogspot.com/2012/02/fbdidlogin-never-calledwhy.html

I ended up commenting out:

    if (!)
    {   ;

Because I seem to be able to post feeds to my Facebook wall even without it (don’t know why, anyone care to explain?).

Another helpful link: How to include a link in my feed-post using FBConnect from iPhone app? (http://stackoverflow.com/questions/5574433/how-to-include-a-link-in-my-feed-post-using-fbconnect-from-iphone-app) This answer in this post explains stuff that you can include in your Feed Dialog pretty clearly.

And um, I think that is it. That bunch of codes can post your scores from Unity iOS to Facebook.

Now my other problem is, how to add a share link to the feed my app posted? Anyone, help?

Also check out an old blog post of mine about how to post pictures from Cocos2D iPhone to Facebook: http://purplelilgirl.tumblr.com/post/9406805856/howtoaddfacebooktococos2diphone


Since generated feeds don’t get the share button (I Google-d for 2 days and found nothing, at the end of it, it was a Which Avengers are You? quiz that helped me solve my problem) , do you know what I eventually did? I went back to that Cocos2D blog post and did it that way (That’s what the Avengers app did, by the way, I’m Hawkeye :D). I posted a photo of the results screen, lol, which is actually what my boss suggested in the first place. And since when you post photos, you can include captions (no advertising though), so there. Problem solved -ish.


Okay, I am apparently not a very good Googler, since only saw this today: http://forum.unity3d.com/threads/122681-Free-facebook-Plugin-for-Unity-iOS Free, Facebook, Unity, iOS, all the keywords that I’ve been searching for, all along was in the Unity Forums!




By the way, we made an app (the one in the sample), it’s a game and it’s free and it stars a penguin named Maru in search of yummy fishies around the world (so far he only got to Asia)…

Link: http://itunes.apple.com/tw/app/maru-penguin/id521096937?mt=8

How to find out the language of your iPhone when using Unity?

For localizations and stuff, you know? Like say if you want your game to support different languages like English, Chinese, Japanese and stuff.

There’s Application.systemLanguage (I think it’s supported on iOS now, since I tested it on my device and it returns the correct language). It supports these languages: Afrikaans, Arabic, Basque, Belarusian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Estonian, Faroese, Finnish, French, German, Greek, Hebrew, Hugarian, Icelandic, Indonesian, Italian, Japanese, Korean, Latvian, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, Serbo-Croatian, Slovak, Slovenian, Spanish, Swedish, Thai, Turkish, Ukrainian, Vietnamese and Hungarian. And if your selected language is not on that list, it returns: Unknown. So if the language that you want to support is on that list, you don’t have to read the rest of this post. Application.systemLanguage is all you need.

But, but, if you are like me (Taiwanese/Chinese), you might need to support not just Chinese, but Simplified and Traditional Chinese (there is a difference), unfortunately Application.systemLanguage, doesn’t know that difference. But the iOS SDK does.

So I want to use iOS SDK’s way of identifying languages using the code:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSArray *languages = [defaults objectForKey:@”AppleLanguages”];
    NSString *currentLanguage = [languages objectAtIndex:0];

I then save the current language to NSUserDefaults:

[[NSUserDefaults standardUserDefaults] setObject:currentLanguage forKey:@”language”];
[[NSUserDefaults standardUserDefaults] synchronize];

So I can access it in Unity, using PlayerPrefs:


So here’s the thing the iOS code needs to be added in AppController.mm that’s generated when you build Unity iOS.

I added that part before Unity gets called ([self startUnity:application]) inapplication didFinishLaunchingWithOptions.

But, but, every time you build, AppController.mm gets overwritten, so, so, what now?

After Unity 3.5, all you have to do is to drag and drop your AppController.mm file into Plugins/iOS folder inside Unity Assets folder and that copy will automatically overwrite whatever that is generated.

And that is it! 🙂