Thursday, May 28, 2015

Run Unity-generated android APK file in device, with FB app installed (Part 1)

Recently I switch my focus a bit more to game development. Unity is quite a popular tool now, since you can focus more on game design, and it runs more than 20 platforms. Facebook has release SDK for it as well, so game developer can easily integrate social feature into the game.

Though it runs on multiple platforms, there's something to be done specifically on certain platform. One of it is Android OS.

If your Android device has no Facebook app installed, everything is as smooth as silk, but it you has Facebook app installed, your problem comes. There's few helpful videos in Facebook sdk website, however to make it works for almost all circumstances, there's few extra steps to be done. Let's start with basic stuffs first.

1) Go to download the latest Facebook-SDK for Unity, at the time of writing it's 6.2.2.
2) Launch Unity 5 and create a new empty project. Import the Facebook-SDK for Unity ("FacebookSDK-150414_6.2.2.unitypackage")



3) The Facebook-SDK for Unity comes with an interactive scene. Go to "Assets>Examples", open the "InteractiveConsole.unity" scene. This is the place you can test all the Facebook APIs, before integrate it with your game.


4) To run this in Editor, there's few setup you need to do, as describe it the SDK.
5) First, go to "https://developers.facebook.com/apps/" and on top menu, click "My Apps">"Add a New App".


6) Go to "Advanced setup" for familiar the whole picture.


7) Create a new app id.


8) You should be brought to the dashboard of the new app you created. You have "App ID" and "App Secret" given, and you need these info later.



9) Go to "Settings", and key-in your email address.


10) Go to "Status & Review", and make it public. Now these are all the steps to make Facebook SDK run on Unity Editor, but more to come to make it run in Android later.


11) Go back to Unity Editor of the project you created just now. By importing the Facebook-SDK for Unity, you should have a "Facebook" menu right now. Click on it, and you should see something in "Inspector" pane. Copy the "App ID" from step (8) and paste in the Inspector section.


12) Click "Play" and you should see the "Game" section is active by now. Click on the "FB.Init" button.


13) Click the "Login" button, if your AppID is correct. You can see the AppID you pass to Facebook server in the status pane at the top.


14) In Unity Editor, you will be greeted with another pop-up, click "Find Access Token" to get a valid "User Access Token". Don't worry, this screen will be replaced with Facebook login in actual device.


15) It will trigger you default OS browser, and see it supplies along with "AppID" again.


16) For the first-time, you will need to grant permission to gain access. Click that hyperlink in the "User Token" section.


17) Then it'll tell you the token is created. Click "Continue".


18) You will be brought back to previous page, but this time with "User Access Token". Copy this "User Token" value.


19) Paste it in the Unity Editor dialog in step (14) just now.


20) More button will be revealed in the Editor, if the token is valid. Now you are official logged-in. Feel free to try other function.


We proceed to test on Android device testing in another page.

3 comments:

Blog27999 said...

As claimed by Stanford Medical, It's in fact the one and ONLY reason women in this country get to live 10 years more and weigh 19 kilos less than us.

(And actually, it is not about genetics or some secret exercise and really, EVERYTHING to do with "HOW" they are eating.)

BTW, I said "HOW", not "what"...

Click on this link to uncover if this brief quiz can help you release your real weight loss possibilities

Blogger said...

Your Affiliate Money Making Machine is waiting -

Plus, getting it running is as simple as 1, 2, 3!

This is how it all works...

STEP 1. Choose affiliate products you want to push
STEP 2. Add PUSH button traffic (it LITERALLY takes 2 minutes)
STEP 3. See how the system explode your list and sell your affiliate products all on it's own!

So, do you want to start making money?

Get the full details here

Manish Sharma said...

Good information !!! Mobile game developers build unique high-end game mobile game development applications for the users with the focus to deliver high-quality gaming applications with spectacular graphics, HD display, high-end processor, and other essential attributes.