File tree 1 file changed +12
-7
lines changed
crates/bevy_ecs/src/world 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -1156,17 +1156,22 @@ impl World {
1156
1156
result
1157
1157
}
1158
1158
1159
- /// " Sends" an [event ](crate::event).
1159
+ /// Sends an [Event ](crate::event::Event ).
1160
1160
#[ inline]
1161
- pub fn event_send < E : crate :: event:: Event > ( & mut self , event : E ) {
1162
- self . resource_mut :: < crate :: event:: Events < E > > ( ) . send ( event) ;
1161
+ pub fn send_event < E : crate :: event:: Event > ( & mut self , event : E ) {
1162
+ match self . get_resource_mut :: < crate :: event:: Events < E > > ( ) {
1163
+ Some ( mut events) => events. send ( event) ,
1164
+ None => bevy_utils:: tracing:: error!(
1165
+ "Unable to send event `{}`\n \t Event must be added to the app with `add_event()`\n \t https://docs.rs/bevy/*/bevy/app/struct.App.html#method.add_event " ,
1166
+ std:: any:: type_name:: <E >( )
1167
+ ) ,
1168
+ }
1163
1169
}
1164
1170
1165
- /// Sends the default value of the [event ](crate::event) .
1171
+ /// Sends the default value of the [Event ](crate::event::Event) of type `E` .
1166
1172
#[ inline]
1167
- pub fn event_send_default < E : crate :: event:: Event + Default > ( & mut self ) {
1168
- self . resource_mut :: < crate :: event:: Events < E > > ( )
1169
- . send_default ( ) ;
1173
+ pub fn send_default_event < E : crate :: event:: Event + Default > ( & mut self ) {
1174
+ self . send_event ( E :: default ( ) ) ;
1170
1175
}
1171
1176
1172
1177
/// # Safety
You can’t perform that action at this time.
0 commit comments