deleteAllEntities method

void deleteAllEntities()

Removes all entities from the world.

Every entity and component has to be created anew. Make sure not to reuse Components that were added to an int and referenced in you code because they will be added to a free list and might be overwritten once a new Component of that type is created.

Implementation

void deleteAllEntities() {
  entityManager._entities
      .toIntValues()
      .forEach(_entitiesMarkedForDeletion.add);
  _deleteEntities();
}