Prefabs additions & improvements
This new version of Evergine has added several fixed and improvements into the Prefab System. The most significant new features are the possibility of adding and removing components to a Prefab Instance entity and the option of adding children.
Adding entities to a Prefab Instance
Adding an entity to a Prefab Instance is like adding an average child to a normal entity, and you only need to drag and drop an entity or create from the Entities Hierarchy Panel.
In the following picture, we’ve added a bird entity to a tree Prefab Instance (It can be noticed that the tree entities have the (Prefab) label but not the bird entity).
Adding entities to a Prefab Instance doesn’t change the other instances of the same Prefab.
To avoid unforeseen consequences, Evergine doesn’t allow removing entities from a Prefab Instance hierarchy, except the root Prefab Instance entity, causing the removal of the full Prefab Instance from your scene.
Adding and removing components from a Prefab Instance
Another exciting addition has been the possibility to add and remove components from a Prefab Instance entity. Again, it can be done in the same way as a normal entity. Evergine will distinguish the new components from the instanced ones and track the removed ones.
Let’s add a Spinner component to one of our trees.
We’ve decided to add the possibility of removing components and not entities because we understood that the risk of losing the hierarchy consistency is smaller than deleting entities and potentially removing an entire branch of a hierarchy. When we deal with Prefabs we need to keep in mind that they usually demand at least a little bit of inner coherence to properly work.
Next Evergine releases will bring new and interesting features to the Prefab system. Stay tuned!