API

Databox Object Methods

AddData

Add data to a databox object. If table and/or entry does not exist. Databox will create a new table/entry.

    // Returns true on success
    public bool AddData(string _tableID, string _entryID, string _valueID, DataboxType _data)

Example

    public DataboxObject database;
    FloatType _health = new FloatType();
    _health.Value = 100f;
    database.AddData("TableName", "EntryName", "ValueName", _health);

GetData

Returns the data object of type T

    public T GetData<T>(string _tableID, string _entryID, string _valueID) where T : DataboxType

Example

  public DataboxObject database;
  FloatType _floatValue = database.GetData<FloatType>("TableName", "EntryName", "ValueName");

TryGetData

Trys to get the data of a specific type, returns true or false if succeeded.

Example

GetEntriesFromTable

Returns a dictionary with all entries from a table

Example

GetValuesFromEntry

Returns a dictionary with all values from an entry in a table.

Example

SetData

Set data to DataboxObject. Returns true if succeeded.

Example

EntryExists

Checks if an entry in a databox object exists. Returns true or false

Example

ValueExists

Checks if a value in a databox object exists. Returns true or false.

Example

RegisterToDatabase

Takes an existing entry and registers it to a new Databox object. This can be used if you are creating game objects at runtime. The newly created object takes the initial data information from an initial Databox object and registers itself to a runtime save game Databox object. Please see the advanced demo scene example here.

_dbToRegister: The Databox object where we want to add the entry _tableID: The original table name _entryID: The original entry name _newEntryID: The new entry name. You should usually use a unique id for this.

Example

LoadDatabase

Loads the saved databox object

With custom file name.

LoadDatabaseAsync

Loads the saved databox object asynchronously

With custom file name.

Example

SaveDatabase

Saves the databox object to a json file

With custom file name.

SaveDatabaseAsync

Saves the databox object to a json file asynchronously

With custom file name.

Example

UploadToCloud

Uploads the database from the appropriate DataboxObject to the cloud.

DownloadFromCloud

Downloads the database from the cloud by using the settings of the appropriate Databox object.

RemoveDatabaseTable

Remove a complete table from the databox object.

RemoveEntry

Remove specific entry from table

RemoveValue

Remove value from entry.

Databox Object Events

OnDatabaseLoaded

Is being called after database has been loaded.

OnDatabaseSaving

Is being called as soon as saving the databox object starts.

OnDatabaseSaved

Is being called after successfully saving the database.

OnDatabaseCloudDownloaded

Is being called after the database has been downloaded.

OnDatabaseCloudDownloadFailed

Is being called after database download failed.

OnDatabaseCloudUploaded

Is being called after the database has been uploaded.

OnDatabaseCloudUploadFailed

Is being called after database upload failed.

Databox Types

Reset

Resets the value back to it's initial value. When creating a custom class you will need to add the reset functionality to it yourself. See the Create a custom class Example.

Example

OnValueChanged

This event is being called as soon as the appropriate value has been changed. This is also great for custom data binding.

Example

Databox Object Manager

GetDataboxObject

Returns the Databox object according to it's id specified in the DataboxManager.

Databox UIBinding

The UIBinding component allows you to bind ui elements to your Databox object.

Bind

Binds a Unity UI component at runtime to a Databox object.

_databoxObject: The Databox object which should be used _dbID: The database id assigned to DataboxManager _tableID: The name of the Databox table _entryID: The entry name _valueID: The value name

Last updated