Data resiliency against future breaking changes
The engine is in active development. New versions can break your data in unpredictable ways.
In order to be more resilient against future changes to the engine that break backwards-compatibility of the data model you can adhere to both of the following two principles:
Reference Base Data by Name
Runtime Units (RtUnitBhv) are currently the only places where you have to reference Base Data from a Prefab that you craft. As stated in RtUnitBhv, this reference can be made either by giving a reference to the Unit Base or by entering the Unit Base’s name.
| As a matter of fact, if you decide to give the reference and then delete your Base Data, then the reference will point to nothing (Missing). |
So the advice is to reference data by name. To do this use the "Unit Base Name" field inside the RtUnitBhv and not the "Unit Base" field like so:
Create all Base Data via script
Creating your base data via script is a considerable overhead. Also, it will not save you from adapting to future breaking changes to the data model, but it is typesafe. This means that your database creation scripts will get syntax errors after an incompatible engine update, and this is regarded a good thing as it indirectly informs you what exactly has changed. (In addition to the fact that such changes will also be in release notes).
| The engine will always try to be backwards compatible as much as possible, but it will not hesitate to move data around. The correctness, integrity and intuitiveness of the data model is holy. |
| Pros | Cons |
|---|---|
Typesafe |
Maintenance overhead |
Recreating Data takes longer with more data. |
|
Allows procedural data creation. (Example: all human units should have the same base speed) |
You have to know the data model better than normally. |
Fields that are Read-Only in the Editor (because they are NYI) are write-enabled when scripting. |
Howto create Base Data via script.
An example of how to actually create your data via script is inside the TBE_Techdemo. After you extracted this unitypackage you will find the example under TBE_Techdemo/data/init.
Add the InitDatabaseComponent to a GameObject and read its documentation.