Page cover image

Data Model

Like what your seeing?

Introduction

public class DataModel<T>: DataModel
public class DataModel : ScriptableObject

Learn more about this topic in the DataModel Programming Tools guide.

It is intended that you use this to create your core save files as Scriptable Objects. This makes it trivial 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 defining your underlying data type e.g. a serializable object that represents the data you wish to save

[Serializable]
public class MyCharacterData
{
    public string characterName;
    public int level;
    public float3 position;
    public quaternion rotation;
    //... etc.
}

You would then create your DataModel

[CreateAssetMenu(menuName = "My Objects/Character Data Model")]
public class CharacterDataModel : DataModel<MyCharacterData>
{ }

Once complete you can use your new ScriptableObject to represent the currently loaded copy of this data type and you can use its member functions to list the available files of this type as seen on Steam Remote Storage and to read and write given files.

Last updated