Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

world:clear() breaks queryChanged use (0.9.0-beta.0) #147

Open
TheyCallMeRyan opened this issue Dec 1, 2024 · 1 comment
Open

world:clear() breaks queryChanged use (0.9.0-beta.0) #147

TheyCallMeRyan opened this issue Dec 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@TheyCallMeRyan
Copy link

TheyCallMeRyan commented Dec 1, 2024

Description

Again getting no results from queryChanged, but this time it appears to be the inverse of my 0.8.4 issue.

Having an already-initialized queryChanged hookState will fail to catch any new entities.

Steps to reproduce

No Minimum Reproduction right now, but working on making one.

Expected behavior

@TheyCallMeRyan TheyCallMeRyan added the bug Something isn't working label Dec 1, 2024
@TheyCallMeRyan
Copy link
Author

This may have existed in 0.8.4 as well, but the root of the issue is I used world:clear() and expected to be able to continue using the world in systems.

With the current behavior, the line self._changedStorage = {} deletes all active changedStorage and then queryChanged never recreates the component in _changedStorage so changes will never be added to the storage.

Potential solutions would be:

  1. Clearing hookStates as well
  • I think this is ideal for this case, although I'm not sure how it would affect other hookStates or if they should be cleared at all
  1. table.clear() every individual changedStorage[component][storage] so that active updates are deleted, but new updates can still be replicated
  • Also great, but requires a bit more code in clear() and is a bit less efficient but one-time cost
  1. queryChanged checks that the storage still exists in _changedStorage
  • Would need to convert _changedStorage[component] from a list to a dictionary, not preferred because it affects frame-by-frame

@TheyCallMeRyan TheyCallMeRyan changed the title Matter 9.0.0-beta0 queryChanged does not return any entries world:clear() breaks queryChanged use (9.0.0-beta0) Dec 1, 2024
@TheyCallMeRyan TheyCallMeRyan changed the title world:clear() breaks queryChanged use (9.0.0-beta0) world:clear() breaks queryChanged use (0.9.0-beta.0) Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant