Skip to content
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

PersistentData

pointcache edited this page Jan 16, 2017 · 4 revisions

Persistent data is a set of entities that live on the Global Systems stack and persist throughout life cycle. It is essentially just a root object for any entities you add to it. You can save and load persistent data separately from scene data and configs. Having separate persistent data files will act as "profiles" where you can store player progress. You can mark entity as persistent, and it will be moved to persistent data root:

entity.MakePersistent();

This essentially just moves the entity to DontDestroyOnLoad scene and parents to PersistentDataSystem. Use this to implement item transfer from the world to player inventory, and similar uses.

CompRef will only serialize references to components inside persistent root. Upon load all the current children of persistent root will be destroyed, then after one frame the data will be loaded. When completed, event

PersistentDataSystem.OnPersistentDataLoaded

will be called.

Clone this wiki locally