Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

UNity's giving me an error: "The name "JsonConvert" does not exist in the current context. Also, is there any way to get just the "Rank" value or is that the Entry index?

(+1)

Oh, I forgot to mention that you need to import the Json converter from Newtonsoft: https://docs.unity3d.com/2019.4/Documentation/Manual/com.unity.nuget.newtonsoft-...

I might update the download file and include Newtonsoft.Json with the Unity package.

The rank is the entry index, I should've pointed out that the entries are returned in a descending order by score.

(1 edit)

Welp, I'm too noob and I can't figure out how to get Newtonsoft. Clicking your link takes me to a Unity Manual. Clicking that takes me to another one. Link there takes me to Json.Net. CLicking "Download" gives me two options that I can see, none of which I know what to do with, really. I go to Rider and there's an option there to install Newtonsoft.Json, which I did, but it doesn't fix the problem.

  1. Open the Package Manager window in your Unity project.
  2. Click the plus icon on click "Add package from git URL"
  3. Paste this in the URL field and then press Add:
com.unity.nuget.newtonsoft-json@3.0


Well that did the trick! And now I feel silly for forgetting about adding packages that way...

Hey, me again! I really don't want to bother other devs so I plugged away at this for several days but it I can't seem to get it to upload more than one entry in my leaderboard.

I have a script that only uploads an entry if no similar score exists. Every thing's fine if the leaderboard is empty. However, if there's already an entry, a new entry doesn't seem to get uploaded.

What happens is when I get a new score the script runs UploadNewEntry . I get a "successfully uploaded entry data" message. I then run GetLeaderboard to fetch the new entry. I get a "Successfully retrieved" message but no new entry actually appears.

When I clear the leaderboard and run the script again, the new entry appears but no new ones will.

OK. I think I found the issue. It won't upload a new value if the username is already in the leaderboard. I tested it here and in my script.

(1 edit)

Just to note, the score will only get uploaded and submitted if its higher than the previous one in the leaderboard.

Yeah, I figured that out as well. Is there any way to make it so that it gets uploaded even if it's the same user? There's a certain satisfaction to seeing yourself have all the highest scores :D

I can implement a system where you can toggle whether or not you want to keep the same scores, but that also means that someone could just spam the leaderboard with different scores but with the same name. If you want to go with this route, then I have a solution for you that is not so straight-forward, but it involves the usage of the "Extra" field.

You could save the scores of the user locally, then every time you upload a player's score to the leaderboard, you add their previous scores to the Extra field as a string. Then every time you request the leaderboard's entries to load, you can not only display the highscores of the players, but also their previous attempts. How does that sound?

(1 edit)

That's a nice bit of creative thinking! But I think it's fine for now, I've implemented my own thing for now. I decided to just show the user's rank and score as well as the #1 and the rank lower just so they have a general idea where their best score stands relative to others. 

I'm also using multiple boards (1 per level) which are ranked according to speed. So I'm actually using the Extra field to identify which level it is since, afaik, there's no way to query the leaderboard name or other identifier itself? And since it's ranked by time, the highest score is actually the lowest rank but that's easy enough to address with sorting.

Maybe the biggest thing right now is a way to do something if the server can't be reached or the leaderboard is inaccessible for some reason. I'd like to be able to display a message to the player. Right now I can see the log error  msgs in the console but not a way to do something when they happen.


Thank you, again!

I'd suggest using multiple leaderboards for multiple levels, as each leaderboard can only hold 100 entries for now.

I will probably update the library to include a "Ping" function which will check if the server is up or not, and based on that you could show an error message to the player.

Thank you for using my tool, I look forward to improving  it.