I have been looking around, but I haven't found the perfect answer, yet.
I want to to send scores from Unity to a database, without a username, and display the high scores in the highscore menu. How do I do that?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityI have been looking around, but I haven't found the perfect answer, yet.
I want to to send scores from Unity to a database, without a username, and display the high scores in the highscore menu. How do I do that?
There are plenty of pitfalls in designing a system like this. If you are opening up a path to post high scores to a server, you are opening it for everyone - not just your client application. The general rule of thumb is this kind of territory is to never trust what the client is telling you. As soon as you hand the application to someone you've basically given them the key to posting whatever they like.
For a start, you're going to need some way of accepting requests from over the internet - you're best bet is probably using HTTPS. You should also have a database that this interface can connect to (never directly expose your database to the open network, always write a middle-ware application to interface with the outside world and your database). You'd probably be best off with something like a PHP server, or a NodeJS server, or really any back-end technology that is relatively simple and can both connect to a database and accept HTTP requests; personally I'd choose NodeJS but that's because I like it and think it would serve this purpose well.
Next you'd probably want to start implementing a RESTful service on it, you'd need the ability to retrieve high scores, the ability to add them and possibly the ability to update them if you feel it is necessary. You'd simply make a POST
request to your web-facing server, and your server's middle-ware would interpret the data and do what is necessary (either fetching the requested high scores, or inserting a new one in this case).
You could roll-your-own in this case and forgo using the ideas behind REST, but I'd suggest following some form of best practice.
Actually the answer is not short or concist of single line. You required Details guide line/tutorial for that and you can achieve it in two ways
You either require your own server with your code logic(back-end) or you can use free firebase as a backend.
I'd do this by:
Display in game, using the UI & control with http requests.
That gets you up and running.
Better way, but more effort, is to integrate with Steam and to use their high score table (Leaderboard) API