Skip to content

destroyEntity does not affect components #3

@dominx99

Description

@dominx99

Let's assume this use case:

  1. add component with entityId = 1
  2. destroy entity with entityId = 1
  3. getComponent with entityId = 1
const entityId = createEntity();

addComponent(
    entityId,
    new Position({ x: 0, y: 0 }),
);

destroyEntity(entityId);

console.log(world.entities, world.components);

const entity = getComponent({ position: Position })(entityId);

console.log('exists', entity !== undefined, entityId);

result

exists = true

world.entities does not contain entityId = 1, but it still exists in components

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions