It is intended that you use this to create your core save files as Scriptable Objects. This makes it trival to query the Steam Remote Storage interface for records of this file type and to load data into a usable point in memory that can easily be referenced by Unity components.
You would typically start by defaining your underlying data type e.g. a serializable object that represents the data you wish to save
1
[Serializable]
2
publicclassMyCharacterData
3
{
4
publicstring characterName;
5
publicint level;
6
publicfloat3 position;
7
publicquaternion rotation;
8
//... etc.
9
}
Copied!
You would then create your DataModel
1
[CreateAssetMenu(menuName ="My Objects/Character Data Model")]
You do not need to write any code in the body of the DataModel, the base class will implament everything you need for you.
Once complete you can use your new ScriptableObject to represent the currently loaded copy of this data type and you can use its member funcitons to list the available files of this type as seen on Steam Remote Storage and to read and write given files.
Fields and Attributes
Type
Name
Comment
string
extension
The extension to be used with this model
RemoteStorageFile[]
availableFiles
List of available files found on Steam Remote Storage
Type
DataType
The underlying data type used by this model
T
data
The data stored by this model
Methods
Refresh
1
publicvoidRefresh();
Copied!
Reads the list of available files from the remote storage interface and stores them in the availabelFiles collection
Load Data
1
publicvoidLoadByteArray(data);
Copied!
1
publicvoidLoadJson(data);
Copied!
1
publicvoidLoadFileAddress(address);
Copied!
Manually loads data into the model's data field
Export Data
1
publicbyte[]ToByteArray();
Copied!
Outputs the current data as a byte[]
1
publicstringToJson();
Copied!
Outputs the current data as a JSON string
Save Data
1
publicvoidSave(fileName);
Copied!
Saves the current data to the Steam Remote Storage system with the indicated file name