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
And if I say remove the TextWidgetBundle from the KayakApp, it causes a panic. This goes for anything under the RootContext, if i try to remove KayakApp it panics as well
The text was updated successfully, but these errors were encountered:
bayou-brogrammer
changed the title
Remove any elements from KayakApp causes a panic
Removing any elements from KayakApp causes a panic
Nov 14, 2022
What is happening is that the entities are despawned but they still exist in the tree(which lives in context). I think we need a way of resetting the context. Still a question arises from this, what should happen when a widget entity is despawned? Should it be auto removed from the tree? Should we ignore and error or warn in the console?
NMy first pass thought would be to treat it as a react virtual DOM would where removing an element from the dom, alienates it from the context and allows it to be flushed.
I think there should be a warning of an element inside of the tree is attempted to access, but doesn't exist. But this would require a method or methods ontop of the context that allows for removing entities.
Definitely a tricky situation since the easiest solution in bevy is to remove entities recursively like I have shown, but that won't pull them from the context.
EDIT: a first pass I would say remove entities from the tree if they no longer exist within bevy. A second pass might allow for a better use case where we can flush a context and rebuild it forcing any entities not alive to be removed
Using the hello_world as an example, if I have the following setup:
And if I say remove the
TextWidgetBundle
from the KayakApp, it causes a panic. This goes for anything under theRootContext
, if i try to removeKayakApp
it panics as wellThe text was updated successfully, but these errors were encountered: