# Save Data Store

The SaveDataStore component can be used to easily save and load user control configuration data from Rewired. This component is a base class which you can extend to support any data storage format you like.

Rewired also comes with a SaveDataStore_PlayerPrefs component complete with source code which you can use as a template for designing your own custom data storage system using any storage medium (database, binary files, etc.). The SaveDataStore_PlayerPrefs component can also be used directly in your game and will store your user data in Unity's PlayerPrefs.

Usage

Just add a component derived from SaveDataStore (such as SaveDataStore_PlayerPrefs) to your Rewired Input Manager Game Object. When the Rewired Input Manager initializes, it will automatically initialize the SaveDataStore component and make a reference to it accessible via the ReInput.saveDataStore property.

To save user data: ReInput.saveDataStore.Save().
To load user data: ReInput.saveDataStore.Load().

SaveDataStore_PlayerPrefs

This is a user data storage component that uses Unity's PlayerPrefs class for storing data. Whenever a controller is attached, if any data has been saved before for that controller, it will be loaded from PlayerPrefs. If the user has customized his control mappings, these will be loaded on a per-player, per-controller basis. Controller calibration settings and customized Input Behavior settings will also be loaded. Data will be saved manually when Save() is called or automatically when a controller is disconnected from the system.

If "Load Data on Start" is checked in the inspector, all controller data will be loaded at the beginning of the session. This is useful if you want the player's last settings to be loaded automatically for any controllers already attached to the system at runtime.

Actions Controller Maps