Data Manager
Workflow
A component responsible for managing the data. It’s based on Newtonsoft Json, fully integrated with the system, but can also be used for any kind of data-saving purposes, including custom components.
Scripting
using UnityEngine;
using Michsky.DreamOS; // DreamOS namespace
public class SampleClass : MonoBehaviour
{
// DataCategory is a required tag used to categorize data
DreamOSDataManager.DataCategory dataCat = DreamOSDataManager.DataCategory.System;
// Available data categories:
// User, System, Apps, Widgets, Network, DateAndTime
void WritingData()
{
// Save boolean data
DreamOSDataManager.WriteBooleanData(dataCat, "Save Key", true);
// Save string data
DreamOSDataManager.WriteStringData(dataCat, "Save Key", "Your String");
// Save float data
DreamOSDataManager.WriteFloatData(dataCat, "Save Key", 0.5f);
// Save int data
DreamOSDataManager.WriteIntData(dataCat, "Save Key", 1);
}
void ReadingData()
{
// Read boolean data
bool boolValue = DreamOSDataManager.ReadBooleanData(dataCat, "Save Key");
// Read string data
string stringValue = DreamOSDataManager.ReadStringData(dataCat, "Save Key");
// Read float data
float floatValue = DreamOSDataManager.ReadFloatData(dataCat, "Save Key");
// Read int data
int intValue = DreamOSDataManager.ReadIntData(dataCat, "Save Key");
}
void Misc()
{
// Check if data exists - returns boolean
bool dataExist = DreamOSDataManager.ContainsJsonKey(dataCat, "Save Key");
// Delete saved data
DreamOSDataManager.DeleteData(dataCat, "Save Key");
// Delete whole data category
DreamOSDataManager.DeleteDataCategory(dataCat);
}
}
How can we help?
A premium WordPress theme with an integrated Knowledge Base,
providing 24/7 community-based support.