- Home /
Implement own highscore script into existing FB SDK example
Hey guys, so I just started using the Facebook SDK and decided to make my life a little easier and use the given example game "FriendSmash" in this example there is everything i need. The only thing i have to do now, is to implement my current game into this game. So far so good, but now the tricky part I cannot handle atm. I use the Main Menu scene as it is but deleted the actual game scene and replaced it with my game scene. Now I somehow need a way to implement the score that the player gets in my new game scene, into the given FB SDK scripts. So basically I already have a script and a variable the contains the score and now have to find the script and the code line where i have to give the facebook score variable the value of my own score variable to make it work like the example was working before. Can someone help me with this?
Answer by smallbit · Aug 08, 2014 at 08:01 AM
I suggest you will try to recreate the code from Friend Smash in your existing game. Firstly there is a very good tutorial for that in the SDK documentation. Secondly doing that you will learn how it works, and you will be able to solve any future problems by yourself without being dependent on the community. Thirdly you will have much more control over simple things like linking your score to the feed method etc.
Facebook SDK implementation process looks difficult but it is very straight forward and easy to understand if you do it step by step :)
Otherwise not sure what kind of help you are asking for ? No scripts, no nothing to start with .. but if you decide not to do that here is my old submit score method
public void PostScore(int score)
{
if (FB.IsLoggedIn)
{
var query = new Dictionary<string, string>() { { "score", score.ToString() } };
FB.API("/me/scores", Facebook.HttpMethod.POST, delegate(FBResult r) { print("submited" + score); }, query);
}
}
You can call it from your scene script passing your score as parameter..
Your answer
Follow this Question
Related Questions
I'm trying to set a high score but I can't display it in another scene? 2 Answers
Scoring System 1 Answer
Why doesn't my highscore script work? 3 Answers
Facebook leaderboard issue 0 Answers
whats wrong with my high score code? 1 Answer