Create your own database
- Import the package
- By default BGDatabase use database, created for our example, so at this point you may want to look at our example breakdown, if you wish to understand more about how BGDatabase works. Or you can revert your database to example database later to look into example code, here is how to do it
Create your own database.
Window->BGDatabase. Go to
Settings-> Main. Fill Database Folder and Setting folder and hit
Configurationand create table (called Meta)
- Add fields
Databaseand create data for tables (called Entities)
Details about how database files are organized
There are 2 files BGDatabase operates with. The first file is the file with actual database data- it's shared among all users and it's available at runtime. The second file- is the file with user's settings- it's not available at runtime and it's not shared between users- each user has it's own settings.
Database file, named
bansheegz_database.bytesshould be placed right under Resources folder. Resources folder can be anywhere in your project but not under
Settings file (default name is
bansheegz_database_settings.json) has some additional information about database, like widths of the tables columns, data about Export/Import tasks etc. It can be placed in Resources folder next to database file, however it may contain sensitive data, so it's better be placed somewhere else. Go to Settings->Main to chose its path. Additionally, each user has it's own settings file. The path to this settings file is stored in EditorPrefs file. This also means, that settings file location is not transferable between different PCs and need to be chosen separately for each PC.
Reverting database to default (example) database
By default, BGDatabase uses default database, located at
As soon as you create your own database, your database, named
bansheegz_database.bytes will be used.
But you may want to revert to default database, for example, to test how our example scenes are working.
This is very easy to do- locate your
bansheegz_database.bytes file (you can find it's location under
Settings->Main) and rename or move it to another location,
then return to
Window->BGDatabase and press
Default database will be loaded.
As soon as you do not need it anymore: rename your database file back to
bansheegz_database.bytes or move it back from another folder and hit