File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
crates/bevy_mod_scripting_core/src Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ impl<P: IntoScriptPluginParams> Command for CreateOrUpdateScript<P> {
212
212
vec ! [ err
213
213
. with_script( self . id. clone( ) )
214
214
. with_context( P :: LANGUAGE )
215
- . with_context( "saving reload state" ) ]
215
+ . with_context( "saving reload state (shared-context) " ) ]
216
216
. into_iter ( ) ,
217
217
) ;
218
218
}
@@ -222,6 +222,27 @@ impl<P: IntoScriptPluginParams> Command for CreateOrUpdateScript<P> {
222
222
self . reload_context ( guard. clone ( ) , handler_ctxt)
223
223
}
224
224
None => {
225
+ match handler_ctxt. call_dynamic_label (
226
+ & OnScriptReloaded :: into_callback_label ( ) ,
227
+ & self . id ,
228
+ Entity :: from_raw ( 0 ) ,
229
+ vec ! [ ScriptValue :: Bool ( true ) ] ,
230
+ guard. clone ( ) ,
231
+ ) {
232
+ Ok ( state) => {
233
+ reload_state = Some ( state) ;
234
+ }
235
+ Err ( err) => {
236
+ handle_script_errors (
237
+ guard. clone ( ) ,
238
+ vec ! [ err
239
+ . with_script( self . id. clone( ) )
240
+ . with_context( P :: LANGUAGE )
241
+ . with_context( "saving reload state" ) ]
242
+ . into_iter ( ) ,
243
+ ) ;
244
+ }
245
+ }
225
246
bevy:: log:: debug!( "{}: loading script with id: {}" , P :: LANGUAGE , self . id) ;
226
247
self . load_context ( guard. clone ( ) , handler_ctxt)
227
248
}
You can’t perform that action at this time.
0 commit comments