Mobage Unity SDK(Android) Quick Guide
Mobage Unity SDK(Android) Summary
Mobage Unity SDK is a custom plugin for Unity3D by Mobage.The main function is to call Social API with c# when making game in Unity3D,such as get friends list, get user information,payment and so on.
DevelopEnviroment
PC: MacOS X 10.8
Unity3D Pro 3.5.0
Eclipse 4.2.0
Android SDK 2.2
File Structure
Mobage Unity SDK (Android) Installation
Unity3D IDE Environment Setting
1.Open Unity3D IDE,Select Assets->Import Package-> Custom Package…Import MobageUnitySDK.unitypackage.
(If you have installed old version MobageUnitySDK,please delete it before this step.)
2.Select GameObject->CreateEmpty.Rename it with MobageCallback which is used to receive message from IOS.
3.In Hierarchys window , set MobageCallback as follow.Binding scripts,HelloMobage.cs,MobageCallback.cs,BalanceButton.cs.
4.Set the picture Mobage_top_left as follow.
5.Set parameters of MobageGUI as follow.
Unity3D IDE Build Setting
1.Select File->Build Setting…,Switch Platform to Android,click Add Current.
2.Click Player Setting…and set as follow.
a. Set Bundle Identifier:
Region Mainland is cn.mobage.g+YourAppId (Test Appid 13000057)
Region Taiwang is tw.mobage.g+YourAppId (Test Appid 23000013)
b. Set TargetPlatForm with armv7
c. Set Stripping Level Disabled.
3.In unity editor ,open res/xml/init.xml ,
edit platformEnvironment as follow
4.Click Build And Run to execute.
We can change consumerKey, consumerSecret, appId and PackageName by edit MobageUnitySDKActivity.java and AndroidManifest.xml in Eclipse.
Eclipse Environment Setting
1.Open Eclipse,Import the project of MobageUnitySDKforAndroid.
Select File->Import,popup window as follow
Select General->Existing Projects into Workspace,click Next
Select root directory of MobageUnitySDKforAndroid,click Finish
Imported project as follow
2.Set consumerKey, consumerSecret, appId for the game.
a.Open AndroidManifest.xml
Edit package name as follow Region Mainland is cn.mobage.g+YourAppId
Region Taiwang is tw.mobage.g+YourAppId
Edit intent-filter
Region Mainland is mobage-cn-YourAppId
Region Taiwang is mobage-tw-YourAppId
b.Open MobageUnitySDKActivity.java
Edit package directory with new packageName.
Edit consumerKey, consumerSecret, appid and registerMobageResource as follow.
3.Export MobageUnitySDKActivity.jar
Select File->Export,popup window as follow,Select Java->JAR file,and click Next.
Select MobageUnityADKActivity.java and R.java as follow
4.Move the modified file to the directory of Plugins/Android.
a.Replace the generated MobageUnitySDKActivity.jar .
b.Replace the modified AndroidManifest.xml.
c.Edit Bundle Identifier with new packageName,Build and Run。