-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
What problem does this solve or what need does it fill?
Minimize the time spent in the critical section in mutating the World
when loading scenes.
What solution would you like?
A World::merge_with(&mut World)
API that moves all of the entities, components, and resources from the provided world into the world it's being called on. The source world will be empty once complete.
This should support scene loads in a consumptive way. Assuming the scene doesn't need to exist after merging with the world (i.e. an environmental load, not a prefab-like spawn of multiple characters or bullets), this should minimize the need for reflection in the critical path.
This should be safe to do, though any systems in the system registry will likely fail to run once merged into the new world due to a WorldId mismatch. Likewise any metadata-as-entities (i.e. Components as entities) will likely need to be guarded against as well to invalidating the internal state of either world.
What alternative(s) have you considered?
Continue using our current reflection based approach.