Description
Scriptable objects data binding tool allows to inject values from database rows to scriptable objects. Optionally this tool can be executed automatically on database saving. Tool location is "Settings->Data Binding->Scriptable Objects"
How to use the tool
- Rows mapping: the scriptable object class should have BGDatabaseEntityId string field. This field is used to find the database row, and the value should be the target row's ID
-
Fields mappings: the tool use naming convention to map the fields.
Scriptable object fields should have the same name and the same type as database fields.
In our example both scriptable object and database row have
population
(int) field. The only exception is databasename
field, which is mapped toentityName
scriptable object field - The tool can be invoked either manually (by clicking on "Inject now" button) or automatically on database saving (by turning "Enable SO injecting on saving" toggle on). The latter option is preferable if you want to keep scriptable objects data in sync with database data without taking any extra actions
- After tool execution is complete, you can check the execution log to make sure all data is transferred properly. Enable "Detailed log" toggle for detailed information. The log contains the row's name, the scriptable object name, field names and transferred values.