Saving and Loading Data

Before we start, it is important for you to know that you can save and read 4 types of data in the Cloud Save module: int, float, string and bool

This system is very similar to Unity's default PlayerPrefs system, so it will be very familiar to you to include this module in your project and deal with it

Saving Data

To save data, use the methods below, according to the desired data type:

[SerializeField]
SteamCloudSave steamCloudSave;

steamCloudSave.SetInt("coins", 700);
steamCloudSave.SetFloat("time_traveled", 60.5f);
steamCloudSave.SetString("avatar_name", "John Doe");
steamCloudSave.SetBool("joystick_vibration", true);
steamCloudSave.SaveData();

Loading Data

To load data, use the methods below according to the desired data type:

[SerializeField]
SteamCloudSave steamCloudSave;

int coins = steamCloudSave.GetInt("coins");
float timeTraveled = steamCloudSave.GetFloat("time_traveled");
string avatarName = steamCloudSave.GetString("avatar_name");
bool joystickVibration = steamCloudSave.GetBool("joystick_vibration");

Note: As stated earlier, your job is just reading and writing the data during game session. Synchronization work will be done automagically by the Steam client

Last updated