Structural changes
Structural changes, what you need to consider to avoid shooting yourself in the foot.
When making changes to the structure of an Entity
, there are also a few things to consider. In most cases, you can simply edit an entity using Add
and Remove
.
The entity gets a new component and does not have it yet, that fits.
But sometimes you need to take a closer look.
Add and Remove do not check whether the Entity
already has these components. In this case, the entity could already have these components and it would lead to a corrupted memory.
It is therefore recommended that you always check beforehand if you cannot guarantee that an entity has or does not have a component.
Why is that?
Last updated
Was this helpful?