bevy
bevy copied to clipboard
Send `SceneInstanceReady` only once per scene
Objective
Send SceneInstanceReady only once per scene.
Solution
I assume that this was not intentional. So I just changed it to only be sent once per scene.
Changelog
Fixed
- Fixed
SceneInstanceReadybeing emitted for everyEntityin a scene.
Welcome, new contributor!
Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨
Did you notice receiving several times this event?
It should already be sent only once
Yes, I received it multiple times, exactly as many times actually as I had entities in the scene.
I'm not familiar with Bevy's codebase, but from how I understand the code it seems obvious that it calls send_event() once per entity.
EDIT: I only tested in v0.12.1 actually, should I test it on main as well?
I'm on main and seeing this event only once, but this code shouldn't have changed since the 0.12.1
Could you share the scene you're using? I tried with a few gltf files.
Your change should be OK, just trying to understand why you're having this issue here
Could you share the scene you're using? I tried with a few gltf files.
I added a unit test. Without the change in this PR the unit test will fail.
Rebased on main after #11003.
nice test, thanks!
unlike scenes from gltfs, yours has two root entities, which explains what you're seeing 👍
Rebased after cfcb6885e3b475a93ec0fe7e88023ac0f354bbbf.