removeThis method

Entity<T> removeThis()

Schedules removal of this entity from its scene via the callback queue.

Prefer this over calling scene.removeEntity directly during an update or draw pass, where mutating the entity set mid-iteration is unsafe. Returns this for chaining.

Implementation

Entity<T> removeThis() {
  callback(() => scene.removeEntity(self));
  return self;
}