Bolt

Description

Code Generator for Bolt creates custom Units to manage BGDatabase data. All fields are supported (Unity asset fields are readonly, more info)

Supported custom units

With custom units you have full control over database data- you can select/add/update/delete rows. Custom units are generated for each table
# Unit Description
1 GetByIndex Retrieve field values from database by row's index. This is the best method to use inside for-each loop
2 GetById Retrieve field values from database by row's id.
3 GetByName Retrieve field values from database by row's name.
4 SetByIndex Set field values to database by row's index.
5 SetById Set field values to database by row's id.
6 SetByName Set field values to database by row's name.
7 Count Retrieve total number of rows
8 Create Create a new row
9 Delete Delete a row by its index

How to generate

  • Open BGDatabase window Window->BGDatabase
  • Select Settings tab, and chose Bolt
  • Fill in parameters and press Generate button
  • After units was generated, update Bolt units database, by pressing Tools->Bolt->Build Unit Options (or Full Extract if you use Bolt 2.0)
Once you chose your naming scheme package + Classes name prefix/Field name prefix and used your generated units in Bolt's graphs, you should not change these settings, otherwise the references to these units will be lost. The same applies to tables/fields names.

Parameters

Parameter name Description
Code Generator Class to use for code generation (use default one)
Source file Source file to use for generated C# classes (units). All classes will be put into one single .cs file, which should be under your project folder
Package Package (C# namespace) for generated classes. For example MySpace. You can safely leave this setting blank.
Class names prefix Prefix to use for each class name. So if you use B_ prefix, the final class for MyTable table and GetById unit will be named B_MyTableGetById. We have multiple code generators, so using different prefixes for different code generators helps to differentiate generated classes and avoid naming collisions
Field names prefix Prefix to use for each generated property name. So if you use f_ prefix, the final name for intField field will be f_intField. You can safely leave this setting blank.

Difference between getters and setters

  1. Getters are not included into control flow: you can not include them. Values are fetched when requested.
  2. On the other hand, setters are required to be included into control flow, otherwise they will not be executed


Bolt v.2 status

After acquisition of Bolt, Unity restarted alpha cycle for Bolt v.2 with a limited number of users. We are waiting for a beta release to add support for Bolt v.2. Bolt version 2 is currently under development. We are aiming to provide support for the latest alpha release. Check the latest available Bolt v.2 version here

Additional downloads

  1. Custom unit to support SaveLoad addon is available for free download here
  2. Custom unit to support unity assets loading from Addressables system is available for download here