However, we can now specify a collection of templates:
templates:
- A
- B
- C
templates and template are interchangeable
We can also define templates as a comma-separated string (for ease of use):
templates: A, B, C # AKA: "A, B, C"
Multiple Inheritance
One concern with allowing for multiple templates is dealing with the issues of multiple inheritance and possible conflicts that arise from it.
The templating system solves conflicts by simply overriding the components in other templates.
It does so in reverse order.
So if we want a component in B to override a conflicting component in A, we must define it like:
templates: B, A
The reason we do it in reverse order is to better display specificity. More generic templates are listed last since they are (often) less specific. This keeps the most pertinent templates closer to the prototype being defined:
name: "Granny Smith"
templates:
- Apple # Very Specific
- Fruit
- Food
- Thing # Very Generic
Goal
Allows for prototypes to define multiple templates, as suggested here: https://github.com/MrGVSV/bevy_proto/pull/2#discussion_r758901050.
Example
We can define templates the same as before:
However, we can now specify a collection of templates:
We can also define templates as a comma-separated string (for ease of use):
Multiple Inheritance
One concern with allowing for multiple templates is dealing with the issues of multiple inheritance and possible conflicts that arise from it.
The templating system solves conflicts by simply overriding the components in other templates.
It does so in reverse order.
So if we want a component in B to override a conflicting component in A, we must define it like:
The reason we do it in reverse order is to better display specificity. More generic templates are listed last since they are (often) less specific. This keeps the most pertinent templates closer to the prototype being defined:
Tasks