@@ -50,14 +50,15 @@ impl DynamicScene {
50
50
/// Write the dynamic entities and their corresponding components to the given world.
51
51
///
52
52
/// This method will return a [`SceneSpawnError`] if a type either is not registered
53
- /// or doesn't reflect the [`Component`](bevy_ecs::component::Component) trait.
54
- pub fn write_to_world (
53
+ /// in the provided [`AppTypeRegistry`] resource, or doesn't reflect the
54
+ /// [`Component`](bevy_ecs::component::Component) trait.
55
+ pub fn write_to_world_with (
55
56
& self ,
56
57
world : & mut World ,
57
58
entity_map : & mut EntityMap ,
59
+ type_registry : & AppTypeRegistry ,
58
60
) -> Result < ( ) , SceneSpawnError > {
59
- let registry = world. resource :: < AppTypeRegistry > ( ) . clone ( ) ;
60
- let type_registry = registry. read ( ) ;
61
+ let type_registry = type_registry. read ( ) ;
61
62
62
63
for scene_entity in & self . entities {
63
64
// Fetch the entity with the given entity id from the `entity_map`
@@ -99,6 +100,20 @@ impl DynamicScene {
99
100
Ok ( ( ) )
100
101
}
101
102
103
+ /// Write the dynamic entities and their corresponding components to the given world.
104
+ ///
105
+ /// This method will return a [`SceneSpawnError`] if a type either is not registered
106
+ /// in the world's [`AppTypeRegistry`] resource, or doesn't reflect the
107
+ /// [`Component`](bevy_ecs::component::Component) trait.
108
+ pub fn write_to_world (
109
+ & self ,
110
+ world : & mut World ,
111
+ entity_map : & mut EntityMap ,
112
+ ) -> Result < ( ) , SceneSpawnError > {
113
+ let registry = world. resource :: < AppTypeRegistry > ( ) . clone ( ) ;
114
+ self . write_to_world_with ( world, entity_map, & registry)
115
+ }
116
+
102
117
// TODO: move to AssetSaver when it is implemented
103
118
/// Serialize this dynamic scene into rust object notation (ron).
104
119
pub fn serialize_ron ( & self , registry : & TypeRegistryArc ) -> Result < String , ron:: Error > {
0 commit comments