CloudDataManager
Manages persistent cloud data storage for user scripts.
| Type | Name | Interface Description |
|---|---|---|
| Functions | constructor(schema: {[key: string]: number | string}) | • Function: Creates a new CloudDataManager with a defined data schema. Parameters • |
| Functions | getEffectUsageInfo(): EffectUsageInfo | • Function: Returns the current effect's usage statistics. The data is populated by the system after initialization; values may be zero if called before the cloud data has finished loading. Returns An instance with the latest usage stats. |
| Functions | loadData(onSuccess: (data: {[key: string]: number | string}) => void, onFailure?: (error: string) => void): void | • Function: Loads data from cloud storage. Waits for the cloud data to be available (fetched from network on mobile, or read from disk in the editor), then returns an object matching the constructor schema structure. Stored values override cached values; keys not yet persisted retain their last known cached value. The internal cache is updated with the loaded values. Parameters • • |
| Functions | saveData(data: {[key: string]: number | string}, onSuccess?: () => void, onFailure?: (error: string) => void): void | • Function: Saves data to cloud storage. Only keys defined in the constructor schema are persisted; any extra keys in Parameters • • • |
Examples
constructor(schema: {[key: string]: number | string})
let obj = new APJS.CloudDataManager();
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use CloudDataManager here
}
onUpdate(deltaTime: number) {
}
}