Make WorldId Hash and SparseSetIndex #7124
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Currently WorldId can't be hashed in HashMap or used as a key in a SparseSet within bevy. This makes it challenging to branch behavior based on specific worlds (e.g. doing things differently for different SubApps). WorldId just wraps a usize so this should be safe to do.
What solution would you like?
Implement/derive Hash and SparseSetIndex for World.
What alternative(s) have you considered?
Worlds could be semi-uniquely identified through other means, like having a unique resource, but adding utility to the world's ID seems like the most straightforward choice.
Additional context
This would be particularly useful for generalizing cross-app
extract
functions. This came up while I was trying to make a extract function manager between a parent and multiple SubApp worlds, like so:The text was updated successfully, but these errors were encountered: