This is all fields types, BGDatabase currently supports (you can create your own field if it's needed.)
|Field Group||Field name||Field Type||Comments|
|string||string||single line text|
|text||string||multiple lines text|
|animationCurve2017||AnimationCurve||Field target Unity 2017. For Unity >= 2018, download field animationCurve2018 here|
|Unity Primitive nullable||vector2?||Vector2?|
|Unity Assets #5||unityTexture||Texture|
|unitySprite||Sprite||Can accept a single sprite, a sprite from multiple sprite, a sprite from SpriteAtlas|
|unityObject||Object||Starting with v.1.5.6 additional type constraint can be added. Code generators generate proper type (using type from constraint)|
|List of Primitives||listBool||List<bool>|
|List of Unity Primitives||listVector2||List<Vector2>|
|Unity Scene #2||entityReference||BGEntityGo|
Nested Field (#1)
Nested field is a special field, which creates a whole new meta (table), which has many-to-one relation to owner
It means, you can create a linked list with any fields that are supported by BGDatabase.
It is a readonly field (to change it's value- delete or add nested Entities).
To create a nested Entity use special method, which accept the owner of nested entity
BGMetaNested is a class for nested tables (to be used instead of generic BGMetaRow)
Technically, it's a usual table with many-to-one relation to parent table with 2 distinct features:
- To access nested rows you need to choose parent row first using parent table GUI
- If you delete a parent row, related nested rows will also be deleted, cause they are considered as integral part of this parent row
You can read more about nested table concept here
Unity Scene Fields (#2)
There are 2 ways to reference GameObject in the scene
- if this object has BGEntityGo component attached. BGEntityGo is used to reference a row from a database and you can use it's id to get reference to GameObject
- if this object has BGWithId component attached. BGWithId is simple component with generated id, you can use this id to get reference to GameObject
Both methods use UnityObject.FindComponentOfType method and super slow.
Hashtable is a dictionary without generic parameters. Following types are supported as keys: int, string, bool, Guid, custom fields. Following types are not supported as values: Unity assets, relations, hashtable, nullable structs. Null values are also not supported.
With enum/enumList fields you can reference your own enumerations. Important notes:
- Once you created your own enum field, you can not change enum type name or namespace, cause they are stored inside database. To change it you can create exact copy of your enum with different name and change enum type at field's settings
- Values are stored exactly as C# store them- with numeric value. You may consider adding numeric values to your constants so constants reordering does not affect values
Unity Asset Fields (#5)
All these fields are read only. You can reference any Unity asset (UnityObject can be used to reference any asset).
Available loaders are:
|Resources||Asset Bundles (obsolete)||Addressables||Addressables by Guid|
|Recommendations||Use it only if an amount of assets is small. Unity does not recommend to use it (more info)||not recommended under any circumstances||use it if you want database to store asset's address||use it if you want database to store asset's Guid.|
|How asset is loaded||using Resources.Load||using AssetBundle.Load||using Addressables.LoadAssetAsync|
|Prerequisites||asset should be placed under one of Resources folder||asset should be included to one of asset bundles||
|Stored value||path, relative to Resources folder||path within asset bundle||asset address||asset Guid|
|Limitations after asset was added to database (otherwise you need to reassign the value)||path/name can not be changed||name can not be changed||asset address can not be changed, but you can freely move/rename asset||asset Guid can not be changed (it's stored in corresponding meta file), but you can freely move/rename asset|
|More information||Read more about Resources folder and asset bundles here||Read Unity's Addressables manual here. To add support for addressables, please, download our plugin and follow setup/use manual at our download page|