#Entity add and delete events

8 messages · Page 1 of 1 (latest)

nimble nymph
#

How do I listen for additions and deletions of any entity?

sage sage
#

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.

mortal wolf
#

Taking a step back, why would you listen for additions and deletions to the entity?

#

Because I think the mental model is wrong here

prime wave
#

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