Save a variable from an script in an Unity game WebGL to a web server

Good day, I wish to make my question correctly and in the right place, sorry Im a noob in this.

I made a game in Unity and uploaded it to a web page as WebGL to make it playable. Everything works very well, however I have a question to ask you the

experts because if I keep investigating something that maybe it is not even possible I will lose a lot of time.

The game saves the highest score of enemies defeted a player achieves in an internal highScore variable, however, reloading the game restarts the highScore.

Since in the future I will make it necessary to login the web page in order to be able to play the game (I made the page in wordpress), is it possible to

share a variable from an Unity game to the website?

Then I will look for ways to save each player’s highScore in their account and later load it when he signs in and opens the game, however I would like to know

if it will be possible on the Unity side before continuing.

I hope I have been clear, basically what I am looking for is not to lose the value of highScore even if the game is not active.

Thanks in advance.

If you want to preserve the value between the runs or different users you should use a persistent storage. Usually this is a database that you access using web services.

1 Like

Thank you savely00, it seems to me a good option to try. I will look for how does work persistent storage in Unity