- Home /
how to intergrate facebook into a javascript based unity game for andriod
hi there. i have a bit of a problem, i ve been searching the web whole week for tutorials on how to implement facebook into my game.
the game is already complete but all i need is to have a leader-board system using facebook. i've downloaded friend smash and did the tutorial which is c#(which i understand a little, but when i get errors i m completely lost. they are not as easy to fix as javascript which i have more knowledge of)
ive been spending now most of my time looking how to put facebook into the game than on the game itself.
ive been on the facebook developer website and seen the videos which just demo's the sdk and doesnt really show how to do a step by step.
ive been on many forums and stil cant find anything thats helpful.
seeing that the facebook sdk is in c# i want to know if there is anyway to combine my jave script with facebook's c#? my score system uses playerprefs.
i looked at the facebook sdk example and tried to remove the extra things i don't need in the script but get lots of errors which i dont understand.
so please im looking for a complete step by step tutorial
i dont have money to by plugins
who ever helps me ill add your name and details in the credits on the game game is free so i m not gonna make money from it.
I am looking up to do the same.. let's see, if i can find it.
Answer by OWL7seven · Apr 20, 2014 at 11:27 PM
ok i had to figure it out myself. C# is not really that much different from JS
in facebook sdk (interactive script, should be attached to the example scene)the first section is a bunch of functions and the second is the gui.buttons
now when the gui button is pressed it does a funtion which uses the functions on top that i spoke about.
now you remove all the buttons you dont need but be careful when doing so. {} is what will cause most of the errors so make sure when removing a button that its only that button funtion and its {}. taking the Int. function and putting in under the Void Start function will intialize facebook without you pressing the button(doing this you wont be able to run the app on your pc but it will work on your phone). you can try this all firstly by going to facebook developer and registering there then get creating your game and getting the code. from there you can put that code in to unity under the facebook tab that should pop up on top if you imported the sdk correctly.
from there just build the example scene and run it on your phone, mess around with it and and see what each button does.
should be: Friend invite Share app Screenshot and others
i messed around with this till i got it working
but im using google play services for my highscore board now its much easier. so if you got $25 to buy google deve account then rather do that. or i could upload for you if you want on my account (free games only).
Your answer
![](https://koobas.hobune.stream/wayback/20220613142853im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
C# to UnityScript conversion help. 0 Answers
Problem Javascript to C# 3 Answers
dealing with gameObject formations 1 Answer