Entity Spawn Event
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
It would make the detection of new entities faster and easier.
## What solution would you like?
Probably a builtin `EntitySpawnEvent` type that gets dispatched whenever `commands.spawn` is used. It could contain the ID of the entity or something.
## What alternative(s) have you considered?
There's `Added`, but that requires knowing/having access to the component and is `O(n)`. Using an event system would be faster and more flexible in cases where someone would want to know if *any* entity spawns.
## Additional context
Using a generic like `EntitySpawnEvent` would be much faster for retrieving specific component data because using the entity id with `Query::get` is still pretty close to `O(n)`. The components could be checked once per `commands.spawn` call if the component type is restricted on the event level.
Contributor guide
Assessment
This issue has not been assessed yet.