removeParent method

void removeParent(
  1. Entity child
)

Removes the parent from a child entity.

The child will be removed from its parent's Children list.

world.removeParent(child);

Implementation

void removeParent(Entity child) {
  if (!isAlive(child)) return;

  final parent = get<Parent>(child);
  if (parent != null) {
    _removeFromParentChildren(child, parent.entity);
    remove<Parent>(child);
  }
}