-
Notifications
You must be signed in to change notification settings - Fork 5
PersistentData
Persistent data is a set of entities that live on the GlobalSystems 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.
