You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ComponentTraits.md
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -939,6 +939,88 @@ let i = world.entity().is_a_id(e); // not allowed
939
939
940
940
Queries may use the final trait to optimize, as they do not have to explore subsets of a final entity. For more information on how queries interpret final, see the [Query manual](Queries.md).
941
941
942
+
## Inheritable trait
943
+
The `Inheritable` trait indicates that a component can be inherited from (it can be used as target of an `IsA` relationship). It is not required to add this trait to components before using them as target of an `IsA` pair, but it can be used to ensure that queries for the component take into account component inheritance.
Queries must be aware of (potential) inheritance relationships when they are created. A query will be created with support for inheritance under the following conditions:
1018
+
- If the component has the `Inheritable` trait
1019
+
- If the component is inherited from
1020
+
- If the component inherits from another component and is not `Final`
1021
+
1022
+
If a query was not aware of inheritance relationships at creation time and one or more of the components in the query were inherited from, query iteration will fail in debug mode.
1023
+
942
1024
## OnInstantiate trait
943
1025
The `OnInstantiate` trait configures the behavior of components when an entity is instantiated from another entity (usually a prefab). Instantiation happens when an `IsA` pair is added to an entity.
0 commit comments