diff --git a/crates/bevy_scene/src/scene_spawner.rs b/crates/bevy_scene/src/scene_spawner.rs index 73eaa93e4cd18..1a377c6b7ae07 100644 --- a/crates/bevy_scene/src/scene_spawner.rs +++ b/crates/bevy_scene/src/scene_spawner.rs @@ -295,14 +295,19 @@ impl SceneSpawner { self.spawned_instances.contains_key(&instance_id) } - /// Get an iterator over the entities in an instance, once it's spawned + /// Get an iterator over the entities in an instance, once it's spawned. + /// + /// Before the scene is spawned, the iterator will be empty. Use [`Self::instance_is_ready`] + /// to check if the instance is ready. pub fn iter_instance_entities( &'_ self, instance_id: InstanceId, - ) -> Option + '_> { + ) -> impl Iterator + '_ { self.spawned_instances .get(&instance_id) .map(|instance| instance.entity_map.values()) + .into_iter() + .flatten() } }