You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loop starts topoRuntime for all worlds.
queryChanged calls useHookState expecting a pristine result for each world.
Instead, all worlds receive the same result from topoRuntime, and since the first world to call queryChanged there sets hookState.storage, all future worlds will both:
Fail to iterate over any pre-existing entities
Fail to mark _changedStorage[componentToTrack] for that specific world
With the result being that no other world will receive the associated data
It might be possible to do something related to setting unique topoRuntimes for each world in Loop; however, I think a better solution might be to have each world store the storage table as:
world._queryChangedHooks[hookState] = storage
instead of hookState.storage = storage
This would also allow for easy cleanup in queryChangedCleanup.
The potentially larger issue going on here is that using systems within Loop with topoRuntime.start called for all the worlds will make it so any calls to topoRuntime within that system will get the same result for all worlds.
So if you wanted unique values for useEvent/useThrottle/useDeltaTime/other hooks, they'll be the same.
I think in general, other hooks getting the same result in a system with multiple worlds is fine, but I think specifically world:queryChanged is world specific and needs world-specific hook results.
Description
Loop starts topoRuntime for all worlds.
queryChanged calls useHookState expecting a pristine result for each world.
Instead, all worlds receive the same result from topoRuntime, and since the first world to call queryChanged there sets hookState.storage, all future worlds will both:
With the result being that no other world will receive the associated data
Steps to reproduce
Minimum Reproduction:
Output:
queryChanged failed to receive either the Component in World1, or the one in World3 because it processed the one in World2
Expected behavior
I expect queryChanged to work for each world assigned to the Loop and not just the first one called.
The text was updated successfully, but these errors were encountered: