Create your own database

  1. Import the package
  2. 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
  3. Create your own database. Open Window->BGDatabase. Go to Settings-> Main. Fill Database Folder and Setting folder and hit Create button
    empty database will be created at specified location
  4. Go to Configuration and create table (called Meta)
  5. Add fields
  6. Go to Database and 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.

  1. Database file, named bansheegz_database.bytes should be placed right under Resources folder. Resources folder can be anywhere in your project but not under Editor folder.
  2. 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.
Settings file may contain sensitive information, so it's not recommended to keep it public

Reverting database to default (example) database

By default, BGDatabase uses default database, located at Assets\BansheeGz\BGDatabase\Examples\Resources\bansheegz_database_default.bytes 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 Reload button. 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 Reload