Partitioning addon let you split database into several files. All non-marked rows will be stored in the main database file and all marked rows will be stored in the corresponding partition file.
Why use it?
Partition addon can be used if you have chunks of data, which is required to be loaded only in specific scenes. So you can load this data at scene's loading and unload it on scene unloading, thus reducing memory usage. Basically it works well only for read-only data, cause when partition is unloaded- the data is deleted (see Restrictions section for more details).
How it works?
At runtime- only main database file is loaded automatically. Partition files are loaded/unloaded manually from C# scripts
//to load a partition (partition can be index/name/ID) BGRepo.I.Addons.Get<BGAddonPartition>().Load(partition); //to unload a partition (partition can be index/name/ID) BGRepo.I.Addons.Get<BGAddonPartition>().Unload(partition);
Unloading/releasing addressables assets
We provide an option to release/unload partition assets while unloading a partition with additional setup (read more here)
Addon uses naming convwebglention for creating partitions and marking rows as belonging to a particular partition. The rules are:
- To create partitions, create a meta with name "DbPartition". Each row means a separate partition
- To "move" rows to some partition, create "dbPartition" field with type(byte or short or int or relationSingle [related=DbPartition]) and assign some value to it. For numeric fields, you need to assign partition index (1- based, value 0 meaning "no partition", value 1 meaning 1st partition etc.) . For relation field- connect row to a DbPartition rows.
Alternatively, use Partition addon Editor GUI to create configuration fields
- Save load addon does not support saving not loaded partitioned data. Basically partitioning works well only for read-only data, cause when partition is unloaded- the data is deleted
- There is no way to reorder rows from different partitions, cause partition's data is loaded in specific order. Main database is loaded first, then all the partitions one-by-one, so data will always be sorted by partitions. If you changed partitioning information during editing session, press on "Reload" button after saving database to view actual rows order.
- Partition addon takes effect only when saving main database in Unity Editor and loading main database at runtime. It has no effect in all other scenarios
- Make sure, loaded/unloaded data is not referenced from main database part (e.g. no relations fields referencing partition data from main (non-partitioned) database)
|Disable temporarily||Temporarily disable addon without deleting corresponding configuration data (e.g. DbPartition table etc.)|