I want to get the coordinates of the entity that is about to be removed when world.beforeEvents.entityRemove.subscribe is triggered. I couldn't use entity.location.
world.beforeEvents.entityRemove.subscribe((ev) => {
const { entity } = ev;
console.log(entity.location.x, entity.location.z);
});
TypeError: cannot read property 'location' of undefined