LogoPixi’VN

Storage

How to store, retrieve, and manage persistent and temporary variables in Pixi’VN, including Keyv integration.

It is essential to understand that if variables are not saved in the game memory, the engine will not be able to handle them when you load a save or when you go back.

Additionally, in the game archive you can save any type of variable, except class and function (because they cannot be converted to JSON), such as: string, number, boolean, object, array, etc. If you want to save "flags" (boolean), it is recommended to use the flags functionality, a very high-performance flag management system.

ink

Sie können diese Methode mit der ink-Syntax verwenden. See more here.

Setzen

To set a variable in the game storage, use storage.set.

import { storage } from "@drincs/pixi-vn";

storage.set("myVariable", 42);

Abrufen

To get a variable from the game storage, use storage.get.

import { storage } from "@drincs/pixi-vn";

const myVariable = storage.get("myVariable");

Entfernen

To remove a variable from the game storage, use storage.remove.

import { storage } from "@drincs/pixi-vn";

storage.remove("myVariable");

Weitere Funktionen

Auf dieser Seite