Interface IBindingStorage
Defines a backend for storing and retrieving serialized input binding overrides on a per-profile basis.
Namespace: Scylla.Input
Assembly: ScyllaInput.dll
Syntax
public interface IBindingStorage
Remarks
Implementations of this interface decouple the InputBindingManager from any particular persistence mechanism. The framework ships two built-in implementations:
- PlayerPrefsBindingStorage
Stores bindings in Unity's
PlayerPrefsregistry. Zero configuration required; suitable for most standalone and console titles. - JSONFileBindingStorage
Writes one JSON file per profile under
Application.persistentDataPath. Suitable when files must be easily inspected, shared, or modified by players (modding support).
All data exchanged with the storage layer is opaque JSON produced by ExportBindingsAsJSON() and consumed by ImportBindingsFromJSON(string). The storage backend is never responsible for parsing the binding payload itself.
Custom backends can be registered at any time via SetStorage(IBindingStorage). Swapping the backend after initialization does not automatically migrate existing saved data.
Properties
StorageID
Gets a short, human-readable identifier that names this storage backend.
Declaration
string StorageID { get; }
Property Value
| Type | Description |
|---|---|
| string | A non-null, non-empty string that uniquely identifies the backend, such as
|
Methods
DeleteBindings(string)
Permanently removes the saved binding data for the given profile.
Declaration
bool DeleteBindings(string profileID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | The non-null, non-empty string that identifies the profile to delete. |
Returns
| Type | Description |
|---|---|
| bool |
|
GetAllProfiles()
Returns the identifiers of every profile that currently has saved binding data in this storage backend.
Declaration
IReadOnlyList<string> GetAllProfiles()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> | A non-null, read-only list of profile ID strings. The list is empty if no profiles have been saved or if the backend cannot enumerate them. The order of entries is implementation-defined. |
HasBindings(string)
Determines whether saved binding data exists for the given profile.
Declaration
bool HasBindings(string profileID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | The profile identifier to check. Returns |
Returns
| Type | Description |
|---|---|
| bool |
|
LoadBindings(string)
Retrieves the previously saved JSON binding data for the given profile.
Declaration
string LoadBindings(string profileID)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | The non-null, non-empty string that identifies the profile slot to read from. |
Returns
| Type | Description |
|---|---|
| string | The raw JSON string that was passed to SaveBindings(string, string) for this profile,
or |
SaveBindings(string, string)
Persists the supplied JSON binding data under the given profile identifier.
Declaration
void SaveBindings(string profileID, string jsonData)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profileID | The non-null, non-empty string that names the profile slot to write into (for
example |
| string | jsonData | The JSON string produced by ExportBindingsAsJSON(). Must not be null or empty; implementations should log a warning and return early if it is. |
Remarks
Implementations are expected to handle I/O failures gracefully - logging the error and returning without propagating an exception to the caller.