Closed Shatur closed 6 months ago
Good idea, thanks. Added by 87df3aaf708e6c64b1340d137aeb481506c01bff.
@komadori Thanks! But I see that you use SceneSpawner
. I think it's slover to iterate over all scenes. Instead you can just listen for SceneInstanceReady
events.
@Shatur My thinking at the time was what would happen if you added AsyncSceneInheritOutline
after the scene had already loaded. I see now that a system that queried Added<AsyncSceneInheritOutline>
could handle that in addition to listening for SceneInstanceReady
, although I'm not sure if it's actually worth the bother.
More generally, I'm not entirely happy with the abstraction offered Bevy. Reading the discussion on bevyengine/bevy#9115, I'm not convinced that SceneInstanceReady
wouldn't have been better as a marker component than as an event. While I'm not a bevy_ecs expert, I would think that the transient cost of an extra archetype while a scene is loading would be small compared to the cost of actually loading a scene and realising it. This would allow you efficiently query (With<AsyncSceneInheritOutline>, With<SceneInstanceReady>)
, whereas the event is produced for every scene even if it isn't marked.
Anyway, I'll have a see about changing it to use the event.
I suggested the marker component initially, but they decided on the event, so I edited the issue. After using it for some time, I found it quite convenient.
Yes, I saw. Thanks for working on it. I think it will use some kind of per-entity event/observer pattern in the future once Bevy has support for it, and that will be the best solution.
bevy_xpbd have AsyncSceneCollider which initializes all colliders from meshes after scene loading.
It would be convenient to provide something like
AsyncSceneOutline
component and a system that listens for SceneInstanceReady event and for all entities withAsyncSceneOutline
inserts InheritOutlineBundle to all their children.