IUserWorldDataStoreService

User World Data Store Service

Interface

This service provides access to the Users datastore for the current world. Spaces that belong to the same world share the same user world datastore.

Remarks

public int playerHighScore = 0;

public void LoadHighScore()
{
SpatialBridge.userWorldDataStoreService.GetVariable("playerHighScore", 0).SetCompletedEvent((response) => {
//once the GetVariable request is completed this code will run.
playerHighScore = response.intValue;
Debug.Log("Player High Score: " + playerHighScore);
});
}

public void SaveHighScore()
{
SpatialBridge.userWorldDataStoreService.SetVariable("playerHighScore", playerHighScore);
}
public int playerHighScore = 0;

public void LoadHighScore()
{
SpatialBridge.userWorldDataStoreService.GetVariable("playerHighScore", 0).SetCompletedEvent((response) => {
//once the GetVariable request is completed this code will run.
playerHighScore = response.intValue;
Debug.Log("Player High Score: " + playerHighScore);
});
}

public void SaveHighScore()
{
SpatialBridge.userWorldDataStoreService.SetVariable("playerHighScore", playerHighScore);
}

Methods

ClearAllVariables()

Delete all variables in the dataStore.

DeleteVariable(string)

Delete the variable at the given key.

DumpVariablesAsJSON()

Dump all variables as a json string. Useful for debugging.

GetVariable(string, object)

Retrieves the value of a variable at the given key.

HasAnyVariable()

Checks if the dataStore has any variables.

HasVariable(string)

Checks if a variable exists at the given key.

SetVariable(string, object)

Set the value of a variable at the given key.