08-21-2019 10:45 AM
...
data[key] = value;
Rooms.UpdateDataStore(Room.ID, data).OnSuccess("Rooms.UpdateDataStore", (room) =>
{
Debug.Log($"[Room] Successfully updated datastore on room ({room.ID}) with [{key}] | [{value}]");
});
public static void OnSuccess<T>(this Request<T> request, string actionName = null, Action<T> callback)
{
request.OnComplete((message) =>
{
if(message.IsError)
{
if(string.IsNullOrEmpty(actionName))
actionName = "Unknown Oculus Request";
var error = message.GetError();
error.Log(actionName); // uses my own extension method for logging prettily
return;
}
else
{
callback(message.Data);
}
});
}