A simple high-score table with a database
Go to this Glitch.com project and select the "Remix on Glitch 🎤" option in the fish menu to set up the database & website server
Include ScorePoster.cs anywhere in your Unity project
Make sure to update the url and game key to point to your Glitch project
Do GenericScores.ScorePoster.PostScore(nickname, score)
to post a score to the high-score table
If you want to run some code when the request to the server has gone through, do it like this instead:
await GenericScores.ScorePoster.PostScore(nickname, score).ContinueWith((task)=>{
// The server has finished
// task.Result contains the response from the server
// It should be { message: "success" } if all has gone well
});
You can use the TestPostScores.cs script as a basis for your own code