Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Nice Game. But how did you save the current level between site reloads on itch.io? Because i think you cant set cookies.

Thank you for the feedback. You can save data on any platform with PlayerPrefs. Example: 

I want to save current level: PlayerPrefs.SetInt("currentLevel", 4);

If I want to then read the data use this: PlayerPrefs.GetInt("currentLevel");

You can use this with int, float and string variable types.

If you have any questions feel free to ask.

(1 edit)

Ok. Do you know how this work in the backend because i am not using unity. My whole games are made with HTML 5 without any engine. 

You can do this in plain Javascript. It's basically the same as in Unity.

Example: 

Save the current level 

window.localStorage.setItem('currentLevel', '5');

Read the current level

window.localStorage.getItem('currentLevel');

There are also a couple more methods:

window.localStorage.removeItem('currentLevel');

window.localStorage.clear(); Use this to delete everything in local storage

window.localStorage.key(index); Use this to get the name of the key(variable) name at a specific index, you can use this to loop through all the keys


I think this is great for saving game data, because it's fast, easy to use and all major browsers support it.

You shouldn't save any users' sensitive information using this, because any code on the website can access it. If you will be saving personal information of the users, you should encrypt it.

I don't think this would be a problem, but major browsers usually limit this storage space to 5MB, but since you will be saving plain text, it won't be a problem even for a game which has a lot of data to save.

If you have any other questions or want to help with something I'd be happy to do that :)

Thank you very much. I did not knew that there is a localStorage. I always saved data with Cookies or in a Database but i cant do this because i cant use backend languages on itch.io.

Although you can't use back-end languages on itch.io, you can use a front-end language (such as Javascript) to connect to an API (run by a back-end language on a server) and achieve the same functionality as you would with a back-end language right in the game.