Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hey, could you show me how you're attempting to use the IsMine method?

(-1)

I followed this tutorial video to implement the scoreboard:

But I'm not displaying the scores, only loading the scoreboard, because I don't want my game to display them all, just the player's personal score. So, I haven't included the loops shown in the video, just the function, and an empty version of the "LeaderboardCreator.GetLeaderboard" condition.


At present, I just have the function showing the top three scores, for the sake of testing, but my next step is to access the player's personal score and display that (which I'll then use to get the scores ranked directly above and below it).


So far, the condition looks like this:

LeaderboardCreator.GetLeaderboard(publicLeaderboardKey, ((msg) =>

        {

            

            rank1text.text = "#" + msg[1].Rank.ToString();     //Set the highest displayed rank

            rank1nameText.text = msg[1].Username;       //Set the highest displayed rank's name

            rank1scoreText.text = msg[1].Score.ToString();       //Set the highest displayed rank's score

            rank2text.text = "#" + msg[2].Rank.ToString();     //Set the middle displayed rank

            rank2nameText.text = msg[2].Username;       //Set the middle displayed rank's name

            rank2scoreText.text = msg[2].Score.ToString();       //Set the middle displayed rank's score

            rank3text.text = "#" + msg[3].Rank.ToString();     //Set the lowest displayed rank

            rank3nameText.text = msg[3].Username;       //Set the lowest displayed rank's name

            rank3scoreText.text = msg[3].Score.ToString();       //Set the lowest displayed rank's score

            //bool isMine = msg.IsMine();

            //Debug.Log(msg.IsMine().Score);

            //Debug.Log(LeaderboardCreator.GetPersonalEntry(publicLeaderboardKey, Whatever goes in here));

        }));


You can see lines I've commented out. These were my attempts to use IsMine() and GetPersonalEntry, but every attempt gave me an error.

(2 edits)

Anyhow, I don't think it's the GetMine() method I need, it's the GetPersonalEntry() method. Took me a while, but I finally figured out how to use it.


Incidentally, is there a boolean I can call if the Leaderboard fails to load? I.e. if the player is offline. I just want to use it to display a message if the leaderboard fails to load (I see that the servers for it go down frequently as well).

Hey there, Silver Fang, every function has an optional callback which will return the error message whenever an error occurs, please see the documentation:

https://github.com/danqzq/unity-leaderboard-creator

I mean, to convert it into a boolean within my own script? So I can add something like:

if (loadFail == true)

    failMessage.SetActive(true);

Here's an example usage:

https://github.com/danqzq/unity-leaderboard-creator#displaying-entries-in-a-list