File tree 1 file changed +27
-0
lines changed
crates/bevy_ecs/src/system
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,23 @@ where
112
112
}
113
113
}
114
114
115
+ pub ( crate ) struct Remove < T >
116
+ where
117
+ T : Bundle + Send + Sync + ' static ,
118
+ {
119
+ entity : Entity ,
120
+ phantom : PhantomData < T > ,
121
+ }
122
+
123
+ impl < T > WorldWriter for Remove < T >
124
+ where
125
+ T : Bundle + Send + Sync + ' static ,
126
+ {
127
+ fn write ( self : Box < Self > , world : & mut World ) {
128
+ world. remove :: < T > ( self . entity ) . unwrap ( ) ;
129
+ }
130
+ }
131
+
115
132
pub trait ResourcesWriter : Send + Sync {
116
133
fn write ( self : Box < Self > , resources : & mut Resources ) ;
117
134
}
@@ -319,6 +336,16 @@ impl Commands {
319
336
} )
320
337
}
321
338
339
+ pub fn remove < T > ( & mut self , entity : Entity ) -> & mut Self
340
+ where
341
+ T : Bundle + Send + Sync + ' static ,
342
+ {
343
+ self . write_world ( Remove :: < T > {
344
+ entity,
345
+ phantom : PhantomData ,
346
+ } )
347
+ }
348
+
322
349
pub fn set_entity_reserver ( & self , entity_reserver : EntityReserver ) {
323
350
self . commands . lock ( ) . entity_reserver = Some ( entity_reserver) ;
324
351
}
You can’t perform that action at this time.
0 commit comments