allAlive property

Iterable<Entity> get allAlive

Returns an iterable of all alive entities.

Note: This iterates through all entity slots, which may be slow if many entities have been despawned. Prefer iterating through archetype tables when possible.

Implementation

Iterable<Entity> get allAlive sync* {
  for (int id = 0; id < _meta.length; id++) {
    final meta = _meta[id];
    if (meta.isAlive) {
      yield Entity(id, meta.generation);
    }
  }
}