Data validation allows to set the rules to validate data. Validation works in Unity Editor only and has no effect at runtime. To turn on validation, press on "Validation off" button at the top left of BGDatabase window.
Validation types
- Database data validation
- Scene objects validation (Binders and BGEntityGo components)
Database data validation
Validation rule | Description |
---|---|
Entity name is unique | If entity has a name, it should be unique |
Entity name is empty | Entities should have no name (names can be cleared under Configuration tab) |
Entity is singleton | Only one single entity should exist |
Field is required | Field should have some value. Only class-based fields are affected, cause struct-based fields always have a value |
Key is unique | Each key, marked as unique, should have 0-1 matching rows. If there are more than 1 matching row, it's considered to be a rule violation. |
To review validation log, hover over red E icons as shown on the screenshot below. E icon is shown only if at least one error exists.
Scene objects validation
Following BGDatabase scene components can also be validated (using Scene Explorer tab).
- BGEntityGo components
- Generated MonoBehaviour classes (extending from BGEntityGo)
- Data binders
Any component, which has an error, will be highlighted.