-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Emit an event when a scene has finished being spawned #2218
Copy link
Copy link
Closed
Labels
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
Metadata
Metadata
Assignees
Labels
A-AssetsLoad files from disk to use for things like images, models, and soundsLoad files from disk to use for things like images, models, and soundsC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
Spawning a scene happens asynchronously and there isn't a pattern I know of to perform a callback when a scene finishes spawning. In my case, my scene contains a bunch of entities with
Groundcomponents; when the scene is done spawning, I want to addSpriteBundles to them.What solution would you like?
Emit an event when a scene has finished spawning, roughly here: https://github.com/bevyengine/bevy/blob/main/crates/bevy_scene/src/scene_spawner.rs#L242
It is desirable that this event includes the
InstanceIdWhat alternative(s) have you considered?
I currently have a workaround where I use a
Query<&Ground, Without<Sprite>>and insert sprites whenever the scene finishes loading. This is no-op after the first time.Additional context
I have talked this over with @TheRawMeatball & @alice-i-cecile in discord a bit.