In the previous chapter, we implemented most of the logic of our application. However, every time the user closes the application, all their tasks disappear. This is because our application is not persisting data.
To make data persistent, we need in some way to store it. The first intuitive way is to store the data locally, which means saving to a file.
Unity offers a quick and easy way to store data persistently by using
PlayerPrefs, a special class where there are functions to save primitives, such as integers or strings. In the following examples, we will work with strings, but the process is the same for all the other primitives.
It is possible to save the data by using the following line:
PlayerPrefs.SetString("Your Key", "Your Value");
Basically, it takes a key and a value. The key is important, because we need it when we need to get the value back, maybe in another session (the user used the application, closed...