#Entity add and delete events
8 messages · Page 1 of 1 (latest)
I don't think there's a way to do that.
You could send an event when despawning it, and then listen for that event.
Taking a step back, why would you listen for additions and deletions to the entity?
Because I think the mental model is wrong here
You can do it, but you have to it completely manually
You'd have a system that queries every single entity (ideally you'd have some marker, but it's not actually necessary), and then you'd store them in a resource, and then each frame you update it, and check if there are any that no longer exist (that's your removals)
Bevy_replicon uses this approach for example
For example: https://github.com/lifescapegame/bevy_replicon/blob/master/src/server/despawn_tracker.rs